|
Hello,
You have to think Classes not file.
The best solution is to create a Class libraby project (DLL) that contains your classes
Then if you want to use it, you reference it in your current project.
That's it !
|
|
|
|
|
i think above solutions are good
thanks
-RisKhan-
|
|
|
|
|
Add the file as a 'Link', you get this by clicking the little down arrow on the 'Add' button.
|
|
|
|
|
In my Application i want to Hide Cursor. i want to disable right click,..left click menu strip all.
I try with
Cursor.Show();
ShowCursor(1);
[DllImport("user32")]
public static extern int ShowCursor(int bShow);
but it is not success.Also i need to enable the mouse in one page. i have an internet page also in my application i want to enable the cursor in that page.
So what is the best solution for my application?
|
|
|
|
|
Cursor.Hide();
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)Expect everything to be hard and then enjoy the things that come easy. (code-frog)
|
|
|
|
|
yes Cursor.Hide(); is correct.
Only thing is we need to balance Cursor.Hide() and Cursor.Show()
we can do it by from win API also that do the same,..
ShowCursor(0) and ShowCursor(1)
[DllImport("user32")]
public static extern int ShowCursor(int bShow);
|
|
|
|
|
Hi,
I'm broadcasting a meesage to a port and wait to receive response from all the devices that are connecting to this port.
So I put the receiveFrom() in a while loop. My problem is when there are no more device the application stuck on the receiveFrom (as it doesn't receive...).
I think that I should set a timeout but how to do that?
Thanks,
|
|
|
|
|
Aren't you running ReceiveFrom() on a separate thread?
|
|
|
|
|
|
You can run it on a separate thread. So that the other application areas won't be affected and your application won't get stuck when there no messages to receive.
|
|
|
|
|
Thanks but this is not what I asked for.
Anyway I have found a way to do this.
Thank you.
|
|
|
|
|
Hi All,
How can i express this statement in C# code:
ZipCode is within 1000—1999
the data type of ZipCode is string and i can't change it to int.
if ((ZipCode >= 1000) && (ZipCode <= 1999))
but appraently it wasn't working. and i also did this:
if ((int)(ZipCode >= 1000) && (ZipCode <= 1999))
but it wasn't working either.
Thanks
|
|
|
|
|
Try this:
int code = int.Parse(ZipCode);<br />
if((code >= 1000) && (code <= 1999))<br />
"Do first things first, and second things not at all."
— Peter Drucker.
|
|
|
|
|
|
Since you have it in string, using int.Parse may result in error when you have other than numbers in the string. So always use int.TryParse
bool IsInRange(string zipCode){
int code;
return (int.TryParse(zipCode, out code) && code >= 1000 && code <= 1999);
}
|
|
|
|
|
if ((Convert.ToInt32(ZipCode) >= 1000) && (Convert.ToInt32(ZipCode) <= 1999))
I Love T-SQL
"Don't torture yourself,let the life to do it for you."
|
|
|
|
|
Why not simply compare them as strings?
if (ZipCode >= "1000" && ZipCode <= "1999")
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
Hi,
is there any source-code link to capture youtube videos?
Thanx in advance
(Riaz)
|
|
|
|
|
|
I have a list box that I am populating from a file. My file has a reference ID and I want to display text in the list box and associate it with the ID. This is easy when I display the ID in the list box but I want to hide it without just change the text color to match the text box. Any help would be great.
|
|
|
|
|
Your question is not clear. Please explain it more.
|
|
|
|
|
It's not very clear what you want to do.
If you want to add all items but have no text for items that match a particular ID then you have two options. Both require overriding the ToString method of the objects you are adding to return string.Empty for the ones you want empty.
You can then either add the object itself to the listbox (handy cause you can cast back to the object itself later)
or
When you add the items, call the ToString method and use the ID property to set the Tag.
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)Expect everything to be hard and then enjoy the things that come easy. (code-frog)
|
|
|
|
|
Sorry guys for not being clear.
Here is what I am doing. In the list box I want to show say a list of first names. Each first name has an ID that goes with it. Say John is number 18. If the user clicks on John I want to be able to look up number 18 associated with that John. If I add John to the list box origianlly like this (listBox1.Items.Add(ID[i] + " " + Name[i]);) then getting the 18 is not a problem. But I want to only show to the user John not the ID on each record. Like I said I could change the font color on the ID and not show it that way but I was wondering if there might be another way to do it.
|
|
|
|
|
The list box holds a collection of objects not strings so you can add anything to it. The text it displays is controlled by the ToString method or in it's absence, the base.ToString method. At the moment you're adding a string so the string.ToString method is being called.
Instead, if it's not already - make each person an instance of your own class. In the class, override the ToString method to return just the text you want and add each instance to the list box. To retrieve the ID, cast the listbox item to your class and you will then be able to access that instance's properties including ID.
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)Expect everything to be hard and then enjoy the things that come easy. (code-frog)
|
|
|
|
|
Or even cooler, write a new listbox control that contains a new property called "Hidden" that you can set from the form.
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|