I need to dynamically retrieve the column index of a Windows Forms datagrid column. To reference the column I used the following code:
Unfortunately, the column itself does not have an indexof method or any property that refers to its index. I need to populate a Datagrid Column with a value despite its location in the grid. As of now I am using this code:
As you can see I am hardcoding the column index. The Grid.Item only allows you to use the row number and column number or a reference to a DatagridCell object. Unfortunately the DatagridCell object does not have a constructor where you can use the column name instead of
column number.
Does anyone know of a way around this? Any help would be greatly appreciated!
Manch
Code:
Me.GridAddresses.TableStyles(0).GridColumnStyles.Item("StreetName")
Code:
Grid.Item(i, 3) = dr.Item(1)
column number.
Does anyone know of a way around this? Any help would be greatly appreciated!
Manch