如何在VB中将datagridview1和datagridview2值添加到datagridview3 [英] How to add datagridview1 and datagridview2 values to datagridview3 in VB

查看:60
本文介绍了如何在VB中将datagridview1和datagridview2值添加到datagridview3的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



i有两个datagridview表dt1和dt2,我希望将值dt1和dt2组合在一起,并将组合值放到新的datagridview dt3。

for ex dt1 = 0000,dt2 = 02然后dt3 = 0000,02

如果dt1的第一个值是0000且dt2是02,则dt3中的值应该是0000,02

i尝试了这个但没有工作

对于c = 0到DataDataGridView1.Rows.Count - 1

对于t = 0到DataDataGridView2.Rows.Count - 1

DataGridView3.Rows.Add(DataDataGridView1.Rows(c).Cells(0).Value)

下一页

下一页



提前感谢



我的尝试:




i have two datagridview tables dt1 and dt2,i want to combine the value dt1 and dt2 and put the combined value to new datagridview dt3.
for ex dt1=0000,dt2=02 then dt3=0000,02
if first value for dt1 is 0000 and dt2 is 02,the value in dt3 should be as 0000,02
i tried this but not working
For c = 0 To DataDataGridView1.Rows.Count - 1
For t = 0 To DataDataGridView2.Rows.Count - 1
DataGridView3.Rows.Add(DataDataGridView1.Rows(c).Cells(0).Value)
Next
Next

thanks in advance

What I have tried:

For c = 0 To DataDataGridView1.Rows.Count - 1
    For t = 0 To DataDataGridView2.Rows.Count - 1
        DataGridView3.Rows.Add(DataDataGridView1.Rows(c).Cells(0).Value)
    Next
Next

推荐答案

尝试这样的事情:

Try something like this:
For c = 0 To DataDataGridView1.Rows.Count - 1
    Dim value1 As Object = DataDataGridView1.Rows(c).Cells(0).Value
    For t = 0 To DataDataGridView2.Rows.Count - 1
        Dim value2 As Object = DataDataGridView2.Rows(t).Cells(0).Value
        DataGridView3.Rows.Add(value1, value2)
    Next
Next



DataGridViewRowCollection.Add Method(Object [] )(System.Windows.Forms) [ ^ ]


这篇关于如何在VB中将datagridview1和datagridview2值添加到datagridview3的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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