[英]only first 50 rows are getting copied to clipboard from datagridview in winforms
I have a datagridview myDgv to which data will be filled from database. 我有一个datagridview myDgv,将从数据库向其中填充数据。
I am doing a Ctrl+A (select all) and copying ( Ctrl + C ) when I paste the copied data into excel, only first 50 rows of data is getting copied. 当我将复制的数据粘贴到excel中时,我正在执行Ctrl + A(全选)并复制(Ctrl + C),仅复制了前50行的数据。
Rest of the rows comes blank. 其余行变为空白。
Here is the code in my keydown event 这是我的keydown事件中的代码
If e.Control AndAlso e.KeyCode = Keys.C Then
Dim d As DataObject = myDgv.GetClipboardContent()
Clipboard.SetDataObject(d)
e.Handled = True
End If
when I scroll down the grid till end (last row) and do Ctrl+C and then paste it in excel, all the rows are getting pasted. 当我向下滚动网格直到结束(最后一行)并执行Ctrl + C然后将其粘贴到excel中时,所有行都将被粘贴。
How do I proceed to solve this issue? 我该如何解决这个问题?
use DataGridView.SelectAll
Method to select all rows on using ctrl + A. 使用
DataGridView.SelectAll
方法使用ctrl + A选择所有行。
and use following event to get key pressed: 并使用以下事件来获取按键:
void dataGridView1_KeyDown(object sender, KeyEventArgs e)
{
if (e.Control && e.KeyCode == Keys.C)
{
//call to DataGridView.SelectAll Method
}
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.