Search code examples
vb.netdatatablegetfieldbindingsource

How to get a specific column value from binding source?


I have a BindingSource that is bound to a DataTable in a DataSet.

How can I get a specific column value from the BindingSource and not from the controls?

For example, something like: Msgbox(bindingsource.item(0).value)


Solution

  • Try to convert the BindigSource into a DataRowView then get the data column, like:

    MsgBox(CType(bindingsource.Current, DataRowView).Item(1))
    

    Get value from current row on BindigSource and column(1).

    Or try this:

    MsgBox(CType(bindingsource.List(0), DataRowView).Item(1))
    

    Get value from row 0, column 1 from BindigSource.