本文介绍了Vb.net-显示我在datagrid中选择的列表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个datagridview,显示2个表数据(左连接关系)。

i尝试向我的表单添加另一个listbox的数据网格,当我点击第一个datagridview时我只会看到行datagridview匹配它。



例如,2个表包含togther:

1爸爸aaaa

2爸爸bbbb

3妈妈cccc

4男孩ddddd

5女孩eeeee

(我在包含这些列的数据集中创建了一个datatale)



第一个datagridview行显示:

dad

妈妈

男孩

女孩



1爸爸aaaa

2爸爸bbbb

3妈妈cccc

4男孩ddddd

5女孩eeeee



当我点击第一行时,

我会在oher datagridview或listbox中看到3行:

aaaa

bbbb



我尝试了什么:



尝试几小时视觉工作室2017中的绑定工具,但我还没弄明白。

i have a datagridview that shows 2 tables data (with left join relation).
i try to add to my form another datagrid of listbox that when i click on the first datagridview i'll see only the rows datagridview match it.

for instance, the 2 tables contain togther:
1 dad "aaaa"
2 dad "bbbb"
3 mom "cccc"
4 boy "ddddd"
5 girl "eeeee"
(i created a datatale in dataset contining those columns)

first datagridview rows shows:
dad
mom
boy
girl

1 dad "aaaa"
2 dad "bbbb"
3 mom "cccc"
4 boy "ddddd"
5 girl "eeeee"

when i click on the first row,
i'll see 3 lines in the oher datagridview or listbox with:
"aaaa"
"bbbb"

What I have tried:

try for hourse the binding tool in visual studio 2017 but i have'nt figure it out yet.

推荐答案



  1. []


  1. DataTable.Select Method (String) (System.Data)[^]
Dim firstselection As String = "dad"
Dim filtereddata = dt.Select("familyfunction='" + firstselection + "'")



  • []


  • Enumerable.Select(TSource, TResult) Method (IEnumerable(TSource), Func(TSource, TResult)) (System.Linq)[^]

    Dim firstselection As String = "dad"
    Dim filteredData = dt.AsEnumerable().Where(Function(x) x.Field(Of String)("familyfunction") = firstselection)




  • 这篇关于Vb.net-显示我在datagrid中选择的列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

    08-05 22:48