bump to the first page. I still need help on this issue. There are only 10 types of people in this world; Those who understand binary, and those who don't.
KoRUPT
Posts
-
Column Order in a DataGridView with BindingList as DataSource -
Column Order in a DataGridView with BindingList as DataSourceI am having problems getting the column order in a DataGridView object to display how I want it. Here are my objects: Data object
class CData { //data members private uint id; private string name; private object otherstuff; //constructor ... //standard //get / set public uint ID{ get{ return id; } set{ id = value; } } ... //basic get/set for the other data members
I then create multiple CData objects and place them in a List<CData> object "myList". When I go to bind this list to a DataGridView I use the following codeBindingList<CData> bindlist = new BindingList<CData>(myList); myDataGridView.DataSource = bindlist; myDataGridView.Refresh()
the problem comes when my form is shown and my data is presented. Currently I can not figure out how to order the columns generated from my CData class properties. By default I thought they would show up in the order that they are declared like: | ID | Name | OtherData | but I find that the order is chosen at random (or some other factor I can not figure out) and they display something like: | OtherData | ID | Name | Now normally this wouldnt be too big of a problem but in my real world application I am using a Data object with over 100 fields which are generated from a file with a strict structure layout and it is critical that I see my columns in the proper order. I hope I explained this properly and would appreciate any help that can be offered on the matter. Thank you. PS: If some moderator or something feels I will get more response in the C# forum, please move this post or advise me to move it. There are only 10 types of people in this world; Those who understand binary, and those who don't. -- modified at 17:30 Friday 27th January, 2006