المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : DataGrid



C# Programming
09-04-2009, 01:08 PM
Hi all. I want to get the columns in a DataGrid as an Array and i am trying such a piece of code:

foreach (DataGridViewColumn column in dataGridAppointments.Columns)
{
...
}

Where dataGridAppointments is a DataGrid control. I keep on getting the error message:
'System.Windows.Forms.DataGrid' does not contain a definition for 'Columns'.

How can i manage to loop through the collection of columns.

Wamuti: Any man can be an island, but islands to need water around them!
Edmund Burke: No one could make a greater mistake than he who did nothing because he could do only a little.