469,572 Members | 1,509 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,572 developers. It's quick & easy.

Current row in a datagrid/dataview

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
Oct 21 '05 #1
1 2037
Hi,

"amber" <am***@discussions.microsoft.com> wrote in message
news:58**********************************@microsof t.com...
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

Thanks in advance,
Amber

Oct 21 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by Bill C. | last post: by
2 posts views Thread by Boniek | last post: by
7 posts views Thread by DC Gringo | last post: by
4 posts views Thread by tshad | last post: by
1 post views Thread by amber | last post: by
4 posts views Thread by guiromero | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.