Get value from cell in a DataGrid

  • Thread starter Thread starter James
  • Start date Start date
J

James

I would like to get a value in a cell for the currently
selected item in a DataGrid. The catch is I do not want
to use an index number to access the cell. I want to use
the DataField property of the column for the cell I want
to access for the current row.

I don't want:
objDataGrid.SelectedItem.Cells(5).Text

I do want something like:
objDataGrid.SelectedItem.Cells("CustomerID).Text

or something like you can do with a DataTable:
objDataTable.Rows(0).Item("CustomerID").Value

The main thing is that I want to be able to get the value
out of a cell in a DataGrid using a string and not an
Index.

Thanks
 
One alternative is to assign ordinal values to text is a value pair list,
this way you can look up the reference ( index ) number.

OHM
 
Back
Top