contents   index   previous   next



Sample Code 11

 

Code in Visual Basic form FormMain.

 

'FormMain

 

Option Explicit

 

'Events that are bubbled up this form

Public Event OnExitClick(Cancel As Integer)

Public Event OnLogTableClick()

Public Event OnFactorialTableClick()

Public Event OnAboutBoxClick()

Public Event OnExcelChartClick()

 

 

Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)

    

    Dim AppCancel As Integer

    

    If UnloadMode <> vbFormCode Then

        Cancel = True

        'Fires (bubbles up) OnExitClick event and check returned value

        AppCancel = 0

        RaiseEvent OnExitClick(AppCancel)

        If AppCancel = 0 Then

            Me.Hide

        End If

        

    End If

End Sub

 

Private Sub Form_Resize()

    MSFlexGrid1.Width = Me.Width - 450

    MSFlexGrid1.Height = Me.Height - 1000

    MSFlexGrid1.ColWidth(1) = MSFlexGrid1.Width - MSFlexGrid1.ColWidth(0) - 450

End Sub

 

Private Sub mnuAboutAbout_Click()

    'Fires (bubbles up) OnAboutBoxClick event

    RaiseEvent OnAboutBoxClick

End Sub

 

Private Sub mnuFileExit_Click()

    

    Dim AppCancel As Integer

    

    'Fires (bubbles up) OnExitClick event

    AppCancel = 0

    RaiseEvent OnExitClick(AppCancel)

 

    If AppCancel = 0 Then

        Me.Hide

    End If

 

End Sub

 

Private Sub mnuToolsExcelChart_Click()

    'Fires (bubbles up) OnExcelChartClick event

    RaiseEvent OnExcelChartClick

End Sub

 

Private Sub mnuToolsFactorials_Click()

    'Fires (bubbles up) OnFactorialTableClick event

    RaiseEvent OnFactorialTableClick

End Sub

 

Private Sub mnuToolsLogs_Click()

    'Fires (bubbles up) OnLogTableClick event

    RaiseEvent OnLogTableClick

End Sub

 


Sample Code 12