我可以从mdi父类调用子表单基类方法

时间:2014-04-16 18:32:59

标签: vb.net

我正在尝试从MDI父级中的表单填充子表单中的下拉列表选择。这个下拉列表取自childs基类。它基本上是数据的rolodex,仅使用附加信息填充子项下拉列表,以便用户更轻松。

我的代码:

Public Sub mnufileitem9_Click(sender As System.Object, e As System.EventArgs) Handles mnufileitem9.Click

    If Not ActiveMdiChild Is Nothing Then
        Dim frm As Object
        frm = Me.ActiveMdiChild
        Dim KeyField As String = frm.KeyField
        Dim NameField As String = frm.NameField
        If frm.TableName <> "" Then
            frm.Invoke(New InvokeOpenRolodex(AddressOf frm.frmBaseFM.OpenRolodex))
            Dim r As New ABLM.frmRolodex(frm.TableName, frmLogin.sConn)
            Try
                If r.ShowDialog() <> DialogResult.Cancel Then
                    mSelectedItem = r.Result(KeyField)
                    ChangingTextOnly = True
                    frmBaseFM.ToolStrip_txtKey.SelectedText = SelectedItem
                    ChangingTextOnly = False
                    frmBaseFM.ToolStrip_txtKey.Text = mSelectedItem

                End If
            Catch ex As Exception
                ABLM.LUCAS.Global.Utils.HandleError(ex, Me.Name & ".OpenRolodex")
            End Try
            r.Dispose()
        Else
            MessageBox.Show("TableName property of frmBaseFM has not be coded. No Rolodex can be displayed", "Developer TODO", MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
        End If

    End If
End Sub

0 个答案:

没有答案