|
You can define an interface so you do not have to check for the readonly collection. Then a simple is comparsion will let you know. Also reflection seems unncessary.
A man said to the universe:
"Sir I exist!"
"However," replied the Universe, "The fact has not created in me A sense of obligation."
-- Stephen Crane
|
|
|
|
|
Cheers Guys, hadn't thought of that, What is beneifit of using the XMLSerilizer method as against using a Interface.
Satvinder
|
|
|
|
|
I am using the SendKeys class to switch to a browser and enter login details. This works fine in IE, but in Firefox, the letters are each typed twice (e.g. jjoohhnn), and Tab and Enter don't seem to work correctly.
The right window has the focus, because something is being entered, but not correctly, at least not in Firefox.
I use:
SendKeys.Send("john{TAB}doe{ENTER}");
Is this a problem with the code, or might Firefox be at fault?
Can anyone help?
Thanks!
|
|
|
|
|
I've had similar problems with SendKeys; generally it doesn't seem to work too well. I was able to get around some issues by doing different things with Send, SendWait, and adding an Application.DoEvents call after the Send.
In other words, I've found SendKeys to be unreliable. I suggest you look into sending window messages via the Win32 SendMessage API.
Tech, life, family, faith: Give me a visit.
I'm currently blogging about: Messianic Instrumentals (with audio)
The apostle Paul, modernly speaking: Epistles of Paul
Judah Himango
|
|
|
|
|
hi all,
my operating system is english. and its date format is mm/dd/yy. but in turkish normal date format is: dd/mm/yy.
i wrote a code which stores some datas.
but if i search for some data in database according to date, it gives errors on computers which has turkish operating system.
the only solution is to change date format of such computers to english(us).
but do i have to do that ?
cant i do any trick so that it makes my program run on any computers (which has english or turkish operating systems )?
help please,
thanks in advance,
bye.
|
|
|
|
|
Use UTC format for dates in the database and searching
|
|
|
|
|
You should try using the current culture to get your date format. When converting a DateTime , you should do it using a particular culture. You can use System.Globalization.CultureInfo.CurrentCulture to determine the culture settings of the computer that the program is running on. Also, when you call Parse on a DateTime , use the IFormatProvider : http://msdn2.microsoft.com/en-us/library/kc8s65zs.aspx[^]
Logifusion[^]
|
|
|
|
|
Hi,
What is the difference between the following two lines?
string strTest = "";
string strTest = @"";
Thanks
|
|
|
|
|
Absolutely nothing. @ is only required to prevent escape characters from being interpreted.
|
|
|
|
|
Using the @ symbol allows you to do this
string strTest = @"C:\Program Files\MyApp";
rather than
string strTest = "C:\\Program Files\\MyApp";
|
|
|
|
|
It also allows you to do this:
string s = @"Well, maybe it's
better if you pick up a book
on C#. You'll get quick answers
on the forum, but they won't
be complete. And, sometimes,
they'll have some ""sarcasm"".";
Logifusion[^]
|
|
|
|
|
|
hi all,when i try to access my application(which contain nearly 1000 records) it raise this error message
"timeout expired.timeout period elapsed prior to completion of the operation or the server is not responding"
i dont know what is this prob and why this is happening...any idea.....?
Regards,
ayyp
-- modified at 9:31 Friday 7th July, 2006
|
|
|
|
|
Ok, you're using .NET remoting or sockets? If you're trying to bring over 1000 records in a single call, chances are it's timing out; it gives up after some period of time.
Instead of trying to bring over all 1000 records in a single call, serialize your records into a stream, then send that stream over byte-by-byte. This will be faster, more performant, and more scalable. You also shouldn't get any timeouts this way provided you don't try to stream too many bytes per call. Try streaming 65000 bytes per call, that's 65k and should work alright on high speed connections.
Tech, life, family, faith: Give me a visit.
I'm currently blogging about: Messianic Instrumentals (with audio)
The apostle Paul, modernly speaking: Epistles of Paul
Judah Himango
|
|
|
|
|
sorry,i dont know how to do this can u send any sample code,.......that will help me.........plz.....
Regards,
ayyp
|
|
|
|
|
I have a DataView that contain multiple rows. It has a column say ColumnX that contains values composed of one or more words.
When i pass a multi-word value(one composed of two or more words) to the Find() method of the DataView for search in ColumnX, it just returns me the index of the row where a first word is matched in the ColumnX.
For example:
string searchvalue="Lossy Gray";
int index=dv.Find((object)searchword);
it return index of the row where a match for "Lossy" is found event though thre is row with "Lossy Gray".
I want only index of that row where all words are matched.
Thanks
|
|
|
|
|
How to disable "X" button at the top right of winform ?
Thanks...
|
|
|
|
|
|
Depend on how you would like for it to behave
1. Handle form closing event, set e.Cancel to true Or
2. Use Win32 API
<br />
const int SC_CLOSE = 0xF060;<br />
const int MF_BYCOMMAND = 0x0;<br />
<br />
[System.Runtime.InteropServices.DllImport("user32.dll")]<br />
public static extern IntPtr RemoveMenu(IntPtr menuHwnd, int position, int flags );<br />
<br />
public static void EnableApplicationClose( System.Windows.Forms.Form form, bool val )<br />
{<br />
IntPtr menu = GetSystemMenu( form.Handle, val ? 1 : 0 );<br />
if ( !val && menu != IntPtr.Zero )<br />
RemoveMenu( menu, SC_CLOSE, MF_BYCOMMAND );<br />
else<br />
{<br />
form.Enabled = false;<br />
form.Enabled = true;<br />
} <br />
}<br />
<br />
[System.Runtime.InteropServices.DllImport("user32.dll")]<br />
public static extern IntPtr GetSystemMenu(IntPtr hwnd, int bRevert);
Jup
-- modified at 9:03 Friday 7th July, 2006
|
|
|
|
|
Hi,
I am getting the above mentioned error while excuting the following simple example ( relating to dispose and finalize). Exact output is also attached after the program.
Can any body explain me the cause for this?
Thanks a lot in advance
//#PROGRAM
using System;
namespace test
{
//Base.cs
public class Base : IDisposable
{
private bool disposed = false;
private readonly int id;
public int ID
{
get
{
return id;
}
}
public Base(int theID)
{
id = theID;
}
public void Disp()
{
Console.WriteLine("You can run me after disposing{0}",id);
}
protected virtual void Dispose(bool disposing)
{
if (!disposed)
{
if (disposing)
{
Console.WriteLine("Base Cleaning up managed resources on {0}",id);
// Code to clean up managed resources
}
Console.WriteLine("Base Cleaning up unmanaged resources on {0}", id);
// Code to clean up unmanaged resources
}
disposed = true;
}
public void Dispose()
{
Dispose(true);
GC.SuppressFinalize(this);
}
~Base()
{
//Following line gives error for object 2
Console.WriteLine("*** Finalize called on Base {0}", id);
Dispose(false);
}
}
//Derived.cs
public class Derived : test.Base
{
private bool disposed = false;
public Derived(int theID) : base(theID) {}
protected override void Dispose(bool disposing)
{
if (!disposed)
{
try
{
if (disposing)
{
Console.WriteLine("Derived Cleaning up managed resources");
// Code to clean up managed resources
}
Console.WriteLine("Derived Cleaning up unmanaged resources");
// Code to clean up unmanaged resources
}
finally
{
base.Dispose(disposing);
}
}
disposed = true;
}
}
//Test.cs
class Test
{
[STAThread]
static void Main(string[] args)
{
Derived object1 = new Derived(1);
Derived object2 = new Derived(2);
object1.Dispose();
}
}
}
//#OUTPUT
Derived Cleaning up managed resources
Derived Cleaning up unmanaged resources
Base Cleaning up managed resources on 1
Base Cleaning up unmanaged resources on 1
An unhandled exception of type 'System.ObjectDisposedException' occurred in mscorlib.dll
Additional information: Cannot write to a closed TextWriter.
Unhandled Exception: System.ObjectDisposedException: Cannot write to a closed TextWriter.
at System.IO.__Error.WriterClosed()
at System.IO.StreamWriter.Flush(Boolean flushStream, Boolean flushEncoder)
at System.IO.StreamWriter.Write(Char[] buffer, Int32 index, Int32 count)
at System.IO.TextWriter.WriteLine(String value)
at System.IO.TextWriter.WriteLine(String format, Object arg0)
at System.IO.SyncTextWriter.WriteLine(String format, Object arg0)
at System.Console.WriteLine(String format, Object arg0)
at test.Base.Dispose(Boolean disposing)
at test.Derived.Dispose(Boolean disposing)
at test.Base.Finalize()The program '[3476] test.exe' has exited with code 0 (0x0).
Note that if you comment the lines relating object1, the program runs fine without any exception.
//#OUTPUT WHEN line 1 & 3 are commented in Main()
Derived Cleaning up unmanaged resources
Base Cleaning up unmanaged resources on 2
techno_adi
|
|
|
|
|
Is the console being routed somewhere else? Writing to the console is causing an issue, an ObjectDisposedException, as if the console itself was disposed.
Is the application exiting or something when you're writing to the console? If this is a console application, try adding a Console.ReadLine() at the end of your Main method. That way it won't exit until you press a key.
Tech, life, family, faith: Give me a visit.
I'm currently blogging about: Messianic Instrumentals (with audio)
The apostle Paul, modernly speaking: Epistles of Paul
Judah Himango
|
|
|
|
|
|
I have tried putting Console.ReadLine(), but the error remains the same
And yes i am sorry for that ill-formatted code..
i'll remember to put
next time..
-- modified at 0:46 Tuesday 11th July, 2006
|
|
|
|
|
Hi,
I want to put a timer on each page to see how long it takes a page to load. Can someone please tell me what page event loads first, and what page event loads last? And how I would go about it?
Not looking for code samples, but just advice.
Regards,
Brendan
|
|
|
|
|
I think that PreInit fires first, and Disposed last.
The documentation says that Init and Disposed are the first and last stages of the lifecycle of a control, but the PreInit event was added in framework 2.0 as the Init even fires too late to be usable to set the theme of the page.
If you plan to show the time in the same page, though, the Dispose event is far too late. You have to do it somewhere around PreRender.
If you want to find out the real load time, and not just most of the execution part of the page creation, use Javascript to send along the time when the page was requested, and compare it to the time when the new page has loaded.
---
b { font-weight: normal; }
|
|
|
|
|