如何将所有数据从列表框传输到datagridview [英] how to all data transfer from listbox to datagridview

查看:96
本文介绍了如何将所有数据从列表框传输到datagridview的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在listbox的listboxt列表框中的列表框中总共有56个组合(数据/数字),所以我想发送/传输到datagridview到7行,8列(datagridview)和im工作在vis ual Basic 2010



从列表框中传输的所有数据到datagridview



1,2,3

1,2,4

1, 2,5

1,2,6

1,2,7

1,2,8

1,3,4

1,3,5

1,3,6

1,3,7

1,3,8

1,4,5

1,4,6

1,4,7

1,4,8

1,5,6

1,5,7

1,5,8

1,6,7

1,6,8

1,7,8

2,3,4

2,3,5

2,3,6

2,3,7

2,3 ,8

2,4,5

2,4,6

2,4,7

2 ,4,8

2,5,6

2,5,7

2,5,8

2,6,7

2,6,8

2,7,8

3,4,5

3,4,6

3,4,7

3,4,8

3,5,6

3,5,7

3,5, 8

3,6,7

3,6,8

3,7,8

4, 5,6

4,5,7

4,5,8

4,6,7

4,6,8

4,7,8

5,6,7

5,6,8

5,7,8

6,7,8



这些组合在列表框中有,所以如何转移/发送到datagridview(8列和7行),这些数据如何从列表框转移到datagridview ........ plz帮助我....

i have total 56 combination(data/numbers) in listbox in listbox in listboxt in listbox, so i want to sent/transfer to datagridview into 7 row, 8 Columnn ( datagridview ) and i m working in visual Basic 2010

all data transfer from listbox to datagridview

1,2,3
1,2,4
1,2,5
1,2,6
1,2,7
1,2,8
1,3,4
1,3,5
1,3,6
1,3,7
1,3,8
1,4,5
1,4,6
1,4,7
1,4,8
1,5,6
1,5,7
1,5,8
1,6,7
1,6,8
1,7,8
2,3,4
2,3,5
2,3,6
2,3,7
2,3,8
2,4,5
2,4,6
2,4,7
2,4,8
2,5,6
2,5,7
2,5,8
2,6,7
2,6,8
2,7,8
3,4,5
3,4,6
3,4,7
3,4,8
3,5,6
3,5,7
3,5,8
3,6,7
3,6,8
3,7,8
4,5,6
4,5,7
4,5,8
4,6,7
4,6,8
4,7,8
5,6,7
5,6,8
5,7,8
6,7,8

these Combination it has in listbox, so how to transfer/sent to datagridview (8 Columns and 7 Row), how these data transfer from listbox to datagridview........plz help me....

推荐答案

获取列表框中的所有项目:



Get all the items of the listbox :

foreach (DataRowView drv in listBox1.Items)
        {
            int id= int.Parse(drv.Row[listBox1.ValueMember].ToString());
           
        }





取决于绑定DataGridView的方式以及实际需要更新现有行还是添加新行,您需要使用列表框中的值来执行此操作。



Depending on how you bind your DataGridView and if you actually need to update existing rows or add new rows, you need to use the values from the listbox to do so.


这篇关于如何将所有数据从列表框传输到datagridview的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆