如何在子例程中检查WinForm的System.Windows.Forms.FormClosingEventArgs

时间:2014-02-25 18:19:16

标签: vb.net winforms

FMECA是一个类,它的成员m_fmecaWin

在特定的子例程中,我有一个FMECA类的对象,我需要访问m_fmecaWin的系统事件。

    Private Sub initialiseFMECATableFromLoad(ByVal fmeca As GraphFMECA, ByVal detTable As DataTable)

        fmeca.m_fmecaWin.chkListBox.AllowGrayed = False
        ' need to mark e As System.Windows.Forms.FormClosingEventArgs; e.Cancel = True ' to be reviewed later 

        If fmeca.m_fmecaWin.chkListBox.Items.Count <> 0 Then Exit Sub
        For Each col As GridColumn In fmeca.m_fmecaWin.GridView1.Columns
            fmeca.m_fmecaWin.chkListBox.Items.Add(col.FieldName, col.Caption, CheckState.Checked, True)
        Next
    End Sub

您认为可以在上面的子例程中访问m_fmeca FormClosingEventArgs吗?

谢谢。

1 个答案:

答案 0 :(得分:0)

你能在日常工作中处理结束事件吗?

AddHandler fmeca.m_fmecaWin.FormClosing, Sub (sender As Object, e As System.Windows.Forms.FormClosingEventArgs) e.Cancel = True

我的VB Lambdas可能有点生疏......但我认为语法是正确的......