StackOverflowException在VB.NET中未处理 [英] StackOverflowException was unhandled in VB.NET
本文介绍了StackOverflowException在VB.NET中未处理的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想通过使用以下代码将行从 DataGridViewX1
移动到另一个表单的 DataGridView
中:
按钮单击事件:
Private Sub Button2_Click(ByVal sender As System.Object,ByVal e As System.EventArgs)Handles Button2.Click
/ pre>
frmEncodeDatabase.EncodingCompleteDataGridView.DataSource = DataGridViewX1.Rows
frmEncodeDatabase.Show()
End Sub
另一个表单的
DataGridView
的RowsAdd
事件:EncodingCompleteDataGridView.Rows.Add(frmEncode.DataGridViewX1.Rows)
pre>
现在上面的代码是我遇到问题的地方:StackOverflowException。 (错误的描述如下图所示)
http ://postimg.org/image/4d91ex49j/
解决方案
Dim dt As DataTable = CType(DataGridView1.DataSource,DataTable)
DataGridView2.DataSource = dt.Copy()
它可以将内容从dgv1复制到dgv2。
I want to move rows from
DataGridViewX1
to another form'sDataGridView
by using this code:Button click event:
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click frmEncodeDatabase.EncodingCompleteDataGridView.DataSource = DataGridViewX1.Rows frmEncodeDatabase.Show() End Sub
Another form's
DataGridView
'sRowsAdd
event:EncodingCompleteDataGridView.Rows.Add(frmEncode.DataGridViewX1.Rows)
Now the code above is where I am having problems: the StackOverflowException. (the error's description are in the image below)
http://postimg.org/image/4d91ex49j/
解决方案Dim dt As DataTable = CType(DataGridView1.DataSource, DataTable) DataGridView2.DataSource = dt.Copy()
It lets me copy the contents from dgv1 to dgv2.
这篇关于StackOverflowException在VB.NET中未处理的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文