How to read a column's value

Using VB 2005 Express
I have a form that is populated from a Tableadapter. One of the columns is a value that represents a height in cm. I want to use that value to display the corresponding inch value in a textbox on the form.
So I want to read that column's value and then convert it to inches and write that into the text box - but I don't know how to identify which is the current row I'm in (when I navigate through the table with the BindingNavigator, how do I keep track of the current row ).
Can someone tell me just what I should be looking for in the MSDN help files - I'm very new to this and cant suss it out!

Thanks...


Answer this question

How to read a column's value

  • Stephan Meier

    When you use a bindingnavigator you are also using a bindingsource. You get the current row by accessing the bindingsource.Current property.

    For example

    Private Sub SomeBindingSource_CurrentChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SomeBindingSource.CurrentChanged

    'get the currently bound object

    Dim dr As DataRowView = SomeBindingSource.Current

    End Sub



  • Nikolay Yordanov

    I'm not familiar with the BindingNavigator. However, there're many events which are related to DGV will included a parameter for retrieving the current row. The default variable name is e and you can use e.RowIndex to find out the current row.

  • CSI-IT

    Thanks. That works.

  • How to read a column's value