G
Guest
I need to dynamically retrieve the column index of a Windows Forms datagrid column. To reference the column I used the following code
Me.GridAddresses.TableStyles(0).GridColumnStyles.Item("StreetName"
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
Grid.Item(i, 3) = dr.Item(1
As you can see I am hardcoding the column index (3). 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
Me.GridAddresses.TableStyles(0).GridColumnStyles.Item("StreetName"
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
Grid.Item(i, 3) = dr.Item(1
As you can see I am hardcoding the column index (3). 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