View Single Post
  #1 (permalink)  
Old May 10th, 2008, 11:53 PM
ranjithemail ranjithemail is offline
Registered User
 
Join Date: May 2008
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Help me - fill dataGridView from struct array

Hello,

I am using a dataGridView in my dialog based application developed in c#

And I want to fill that dataGridView from a array of structure.

 struct student
 {
 int nRollno;
 string strName;
 int nTotalMark;
 }

I tried as follows,

Code:
student[] arrayStudentList = new student[10];

//Fill 10 student list here and assign as follows

dataGridView.DataSource = m_arrayStudentList;

but columns are displays in different order like as follows:
-------------------------------
nTotalMark | nRollno | strName
-------------------------------

but i want grid display as folows:
-------------------------------
nRollno | strName | nTotalMark
-------------------------------

Please help me.

Thanks
Ranjith.

Reply With Quote