By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,461 Members | 1,120 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,461 IT Pros & Developers. It's quick & easy.

How to get value from an row in DataView?

P: 1
Hello to everyone!

I am new to VB.NET 2010 Express and ADO.NET, trying to convert an application (VB6, ADO 2.5).

There is an DataView (dv) with 2 fields fld1 (ID) and fld2. There is also an DataGridView (dgv), with just one, predefined as read only, column fld2. Field fld1 (ID) is not visible. DataGridView (dgv) is binded to DataView, so:

...
dgv.AutoGenerateColumns = False
dgv.DataSource = dv
...

While focus is in TextBox (txt) user can hit Down/Up arrow keys and scroll up and down through dgv (and dv), so:

Private Sub txt_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles txt.KeyDown
...
BindingContext(dv).Position +/-= 1
...
End Sub

After any of the rows in dgv is marked, user presses Enter/Return (focus is stil at txe TextBox). Everything, so far, is working just fine.

My question is how to get the value of the field fld1 (ID) for the current row (selected in dgv).

This is, I belive, simple thing, but took me few hours looking for solution similar to one I did with ADO 2.5 Recordset.

Thanks in advance,
Dejan
Nov 3 '10 #1
Share this question for a faster answer!
Share on Google+

Post your reply

Sign in to post your reply or Sign up for a free account.