문제

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)

도움이 되었습니까?

해결책

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.

다른 팁

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)

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top