hi guys. i'm really need this .
i have a datagridview with 5 columns . i just attached my datagridview to my table in my access database what i want to do is to convert the first column from string to int , bcz it's saving as string in database and not as int .
the problem is when i hit the column header to sort the data grid viye by the first column is sorting like this .
but i want to sort it like this 1-2-6-7-8-11-55
.i think it bcz of the string format of the column do you know any way to convert the column . i think it should be fix if i convert the column from string to int or maybe it'll solve in other way .
You have a couple of choices, convert the data type in your select query or add another column either in your query or the data table resulting from the query and populate the new column with the integer value.
And as POH said don't use text speak when you are using a computer!
Never underestimate the power of human stupidity
No. How would you call it? Static constructors are called by the framework at a time which your code can't know*, and without any parameters. In fact the same construct in Java makes this clearer by just being
... so it doesn't look like a callable method (which it isn't).
(*: It's called the first time the class is fully loaded, which I think happens when a method/field/property is called. However, you still don't know when that is because some other code might use the same class.)
If you want to preload state then you can have a parameter-accepting normal static method which you call in the Main procedure or via a static constructor elsewhere. (Obviously, you could call it from anywhere, but you want to call it before you are going to use the class at all, and Main is about the only place you can guarantee that.)
Null Reference Exception?
When you select a different value in a ComboBox, the previous element gets de-selected, causing a SelectedIndexChanged event. Now, nothing is selected, the SelectedIndex is -1. Next, the element you selected gets selected, causing the next SelectedIndexChanged event. And now it is really selected, and you can use it.
You can. A release build is not magic, the main difference is just that the debug version doesn't optimise the code. If you do a release build, take a look in your Release folder - you'll see a number of generated PDB files in there.
To prevent generation of release PDV files, select Project Properties > Build > Advanced > Debug Info: None (make sure the configration is set to Release when you do this).
*pre-emptive celebratory nipple tassle jiggle* - Sean Ewington