I have a datagridview in a 2013 vb.net winforms app.
I can get the value of a cell when identify it by column number but not by column name.
MyValue = DataGridView1.SelectedRows(0).Cells(18).Value
The following two samples do NOT work:
For Each col In DataGridView1.Columns
ecell = DataGridView1.CurrentRow.Index
DataGridView1.CurrentCell = DataGridView1.Item("d200", ecell)
In first example it goes to 'next', doesn't loop, and never prints a column name.
In second example, it produces the error message: "column named d200 cannot be found"
I've tried this on several of its columns and get same error. The column name in database and column caption are identical.
Its as if it does not know its own column names!