I have a datagridview with many columns.I want to give this GridView Columns proper order according to my requirement.
Like example.
I have three columns

I want that the Name should be the first Column,RegNo second and Adress Third.
My application is in Silverlight Coded in C#.Net.
Please guide.
Thanks in advance

Based on the Select query you wrote the columns will come .
for example write in this way : select Regno,Name,Adress,Pincode from temptable
this may gives you correct result

You can set tje order of the columns like:

dataGridView1.Columns["Name"].DisplayIndex = 0;
    dataGridView1.Columns["RegNo"].DisplayIndex = 1;
    dataGridView1.Columns["Adress"].DisplayIndex = 2;
commented: ++ +15

Hi Bonca,
thanks fr ur rply...
but when i use the above code and give name to columns .Columns["RegNo"].DisplayIndex = 0;
its showing error as this.[int] has some invalid argument rather when i use
.Columns[0].DisplayIndex = 0; ,this means it only takes int type...
please suggest...

I have wrote my query tat way only...in sequence to what i want...

Did you sort all the columns? if you change one, you have to re-order all the others. So that two columns wont have same columnIndex maybe.