0
我有一个MDI Parent作为父表单,我用它来打开和组织其他表单作为其中的子表单。我用这种方法打开子窗体:在MDI中处理表单后出错Parent
Public Sub OpenForm(ByVal frm As Form)
frm.MdiParent = MainView
frm.Show()
End Sub
该方法工作正常,我没有任何问题使用它来打开子窗体。我有在每个子形式3项:
1- DataGridViewX(从DevComponents.DotNetBar.Controls)
2-面板
3-用户控件
我可以正确地使用每个这些项目中的并没有出现错误。 DataGridViewX与一个DataSource连接并且一切正确。 当我在MDI Parent中打开2个或更多表单并尝试关闭它们时发生问题。 错误是:
The following exception occurred in the DataGridView:
System.IndexOutOfRangeException: Index 0 does not have a value.
at
System.Windows.Forms.CurrencyManager.get_Item(Int32index)
at
System.Windows.Forms.DataGridView.DataGridViewDataConnection.G" and caption "DataGridView Default Error Dialog".
,这是负责的错误代码:
Partial Class Form1
Inherits DevComponents.DotNetBar.OfficeForm
'Form overrides dispose to clean up the component list.
<System.Diagnostics.DebuggerNonUserCode()>
Protected Overrides Sub Dispose(ByVal disposing As Boolean)
Try
If disposing AndAlso components IsNot Nothing Then
components.Dispose()
End If
Finally
MyBase.Dispose(disposing) '' <<<< ERROR LINE
End Try
End Sub
现在显然我不代码里面的设计师也把用里面的代码表单元素。我使用Designer界面。
我该怎么办? 谢谢