GetValueByName
In beta1 there was a fantastic way of getting values out of a gridview using:
Gridview1.DataKeys(Gridview1.SelectedIndex).GetValueByName("Name").ToString
In beta2 this has been removed - how do I achieve the same results? I used this alot and will have to change a lot of code, especially if I have to use the reader class.
Vince
[336 byte] By [
vruttan] at [2008-2-18]
I think there are some even easier ways to get at specific cells or the Current (selected) cell.
Basically you want to think about getting a cell object as a result of a Row and Collumn coordinate. E.g.
| |
Dim dgv As New DataGridView Dim cell As DataGridViewCell cell = dgv.Rows(0).Cells(1)
|
Here a few more examples building on the same concept, but varying how to access rows and cells
| | cell = dgv.Rows(dgv.CurrentRow.Index).Cells("name") cell = dgv.CurrentRow.Cells( "name") cell = dgv.CurrentCell
|
I hope that helps.
Paul