首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > .NET > VB Dotnet >

DataGridView相关的复制和粘贴解决思路

2012-09-10 
DataGridView相关的复制和粘贴比如说我在DataGridView中有一条记录,我想复制这条记录,然后粘贴,把里面显示

DataGridView相关的复制和粘贴
比如说我在DataGridView中有一条记录,我想复制这条记录,然后粘贴,把里面显示的记录变成2条,就跟Excel里面复制一条记录然后再粘贴一样,最好可以和Excel里面一样可以用键盘的快捷键Ctrl+C和Ctrl+V来操作,只需要有复制和粘贴功能,我是这方面的菜鸟,希望各位大侠可以帮忙解决这个问题,使用VB.Net,谢谢

[解决办法]
Dim r As New DataGridViewRow
r = DataGridView1.Rows(i).Clone
r.Cells(0).Value = DataGridView1.Rows(i).Cells(0).Value
r.Cells(1).Value = DataGridView1.Rows(i).Cells(1).Value
……
DataGridView1.Rows.InsertRange(2, r)
看看DataGridView1.Rows.里面的方法。

热点排行