Current row in a datagrid/dataview

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a datagrid, based on a dataview (filled with dataset data from SQL
server).

The dataview contains an ID field, but this field isn't in the datagrid.

How can I get the ID associated with the current selected row in the datagrid?

Possible?

Thanks in advance,
Amber
 
Hi,

amber said:
I have a datagrid, based on a dataview (filled with dataset data from SQL
server).

The dataview contains an ID field, but this field isn't in the datagrid.

How can I get the ID associated with the current selected row in the
datagrid?

Possible?

You can get the current DataRowView from CurrencyManager.Current (returned
from BindingContext(...)):

Dim drv As DataRowView = DirectCast( BindingContext( _
DataGrid1.DataSource, DataGrid1.DataMember).Current, _
DataRowView)

Dim ID As Integer = CInt(drv["ID"]);


HTH,
Greetings
 
Back
Top