'Form:frmMain Option Explicit Public mousemovecount As Integer Public mousedowncount As Integer Public mouseupcount As Integer Public singleclickcount As Integer Public doubleclickcount As Integer Public lostfocuscount As Integer Public clickcount As Integer Public dragovercount As Integer Public keydowncount As Integer Public keypresscount As Integer Public paintcount As Integer Public deactivatecount As Integer Private Sub Form_Activate() MsgBox "Form Activate event...", vbInformation, "Form Events" End Sub Private Sub Form_Click() If clickcount < 3 Then MsgBox "Form Click event...", vbInformation, "Form Events" clickcount = clickcount + 1 If clickcount = 2 Then frmMain.BackColor = &HFFFF& Else frmMain.BackColor = &H8000000A End If Exit Sub End If End Sub Private Sub Form_DblClick() MsgBox "Form DoubleClick event...", vbInformation, "Form Events" frmdummy.Show End Sub Private Sub Form_Deactivate() If deactivatecount < 4 Then MsgBox "Form Deactivate event...", vbInformation, "Form Events" deactivatecount = deactivatecount + 1 Else Exit Sub End If End Sub Private Sub Form_DragDrop(Source As Control, X As Single, Y As Single) MsgBox "Form DragDrop event...", vbInformation, "Form Events" Source.Move X, Y frmMain.BackColor = &HFF8080 End Sub Private Sub Form_DragOver(Source As Control, X As Single, Y As Single, State As Integer) If dragovercount = 0 Then MsgBox "Form Drag Over event...", vbInformation, "Form Events" dragovercount = dragovercount + 1 Else Exit Sub End If End Sub Private Sub Form_GotFocus() MsgBox "Form Got focus event...", vbInformation, "Form Events" End Sub Private Sub Form_Initialize() MsgBox "Form Initialize event...", vbInformation, "Form Events" End Sub Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer) If keydowncount <= 4 Then MsgBox "Form KeyDown event..." & Chr(KeyCode) & " Key pressed", vbInformation, "Form Events" keydowncount = keydowncount + 1 Else Exit Sub End If End Sub Private Sub Form_KeyPress(KeyAscii As Integer) If keypresscount < 4 Then MsgBox "Form KeyPress event..." & Chr(KeyAscii) & " Key pressed", vbInformation, "Form Events" keypresscount = keypresscount + 1 Else Exit Sub End If End Sub Private Sub Form_KeyUp(KeyCode As Integer, Shift As Integer) MsgBox "Form KeyUp event..." & Chr(KeyCode) & " Key Up", vbInformation, "Form Events" End If End Sub Private Sub Form_Load() mousemovecount = 0 mousemovecount = 0 mousedowncount = 0 mouseupcount = 0 singleclickcount = 0 doubleclickcount = 0 lostfocuscount = 0 clickcount = 0 dragovercount = 0 keydowncount = 0 keypresscount = 0 lostfocuscount = 0 paintcount = 0 deactivatecount = 0 MsgBox "Form Load event...", vbInformation, "Form Events" End Sub Private Sub Form_LostFocus() If lostfocuscount < 4 Then MsgBox "Form LostFocus event...", vbInformation, "Form Events" lostfocuscount = lostfocuscount + 1 Else Exit Sub End If End Sub Private Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single) If mousedowncount = 0 Then MsgBox "Form MouseDown event...", vbInformation, "Form Events" mousedowncount = mousedowncount + 1 Else Exit Sub End If End Sub Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single) If mousemovecount = 0 Then MsgBox "Form MouseMove event...", vbInformation, "Form Events" mousemovecount = mousemovecount + 1 Else Exit Sub End If End Sub Private Sub Form_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single) If mouseupcount = 0 Then MsgBox "Form Mouseup event...", vbInformation, "Form Events" mouseupcount = mouseupcount + 1 Else Exit Sub End If End Sub Private Sub Form_Paint() If paintcount < 3 Then MsgBox "Form pain event...", vbInformation, "Form Events" paintcount = paintcount + 1 Else Exit Sub End If End Sub Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer) MsgBox "Form QueryUnload event...", vbInformation, "Form Events" End Sub Private Sub Form_Resize() MsgBox "Form resize event...", vbInformation, "Form Events" End Sub Private Sub Form_Terminate() MsgBox "Form Terminate event...", vbInformation, "Form Events" End Sub Private Sub Form_Unload(Cancel As Integer) MsgBox "Form Unload event event...", vbInformation, "Form Events" End Sub