Question

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)

Was it helpful?

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.

OTHER TIPS

Try this method:

MsgBox(bindingsource.Rows(0).Item(1))

This gets the value from row 0 and column 1.

It should work.

Here is an answer for your question:

Dim myItme As String = dataTableName.Rows.Item(0).Item("ColumnNameOrIndex")

Try this:

MsgBox(bindingsource.Current!MyField)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top