Number of columns in a DataGridView
I must be missing something very obvious, since even searching for a couple of minutes returned nothing, but how can I get the number of columns in a DatagridView
? The obvious DataGridView1.Columns.Count
is wrong.
I am sorry if this has been asked a million times or has an obvious answer, but I just can't find it.
Edit: I just found at http://msdn.microsoft.com/en-us/library/system.windows.forms.datagridviewcolumncollection.aspx that the DataGridViewColumnCollection
does have a property Count
, so I used it and it worked. However, Intel开发者_JAVA技巧lisense does not suggest it. I had to manually enter it. Strange.
Are you looking for ColumnCount
?
精彩评论