Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/svg/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Vb.net 如何从绑定源获取特定列值?_Vb.net_Datatable_Get_Field_Bindingsource - Fatal编程技术网

Vb.net 如何从绑定源获取特定列值?

Vb.net 如何从绑定源获取特定列值?,vb.net,datatable,get,field,bindingsource,Vb.net,Datatable,Get,Field,Bindingsource,我有一个BindingSource,它绑定到DataSet中的DataTable 如何从BindingSource而不是从控件获取特定列值 例如,类似于:Msgbox(bindingsource.item(0.value)尝试以下方法: MsgBox(bindingsource.Rows(0).Item(1)) 这将从第0行和第1列获取值 它应该可以工作。尝试将BindigSource转换为DataRowView然后获取数据列,如: MsgBox(CType(bindingsource.Cur

我有一个
BindingSource
,它绑定到
DataSet
中的
DataTable

如何从
BindingSource
而不是从控件获取特定列值

例如,类似于:
Msgbox(bindingsource.item(0.value)

尝试以下方法:

MsgBox(bindingsource.Rows(0).Item(1))
这将从第0行和第1列获取值


它应该可以工作。

尝试将
BindigSource
转换为
DataRowView
然后获取数据列,如:

MsgBox(CType(bindingsource.Current, DataRowView).Item(1))
BindigSource
列(1)
上的当前行获取值

或者试试这个:

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

BindigSource
的第0行第1列获取值

Dim myItme As String = dataTableName.Rows.Item(0).Item("ColumnNameOrIndex")
试试这个:

MsgBox(bindingsource.Current!MyField)