VB Chapter 7
VB Chapter 7
VB Chapter 7
01
Fall 2010
Acknowledgement
And
Multiple Forms
Standard Modules
Menus
Introduction
• As in
Private Sub btnClose_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) _
Handles btnClose.Click
Me.Close()
End Sub
Hiding a Form
End Sub
The Form Activated Event
• The Activated event is triggered when focus switches
to the form from another form or application
• The Load event is triggered once when the form is
initially displayed
• The Activated event is also triggered when the form is
initially displayed
– Occurs immediately after the Load event
• The Activated event may be triggered many more
times, each time focus shifts back to the form
Creating an Activated Event Handler
• Create an Activated event handler by selecting frmMain events
from the class name drop-down list
• Then select the Activated Event from the method name drop-
down list
The Form Closing Event
• The Closing event is triggered as the form is being
closed, but before it has closed
• The Closing event can be used to ask the user if they
really want the form closed
Private Sub frmMain_Closing(ByVal sender As Object, _
ByVal e As System.ComponentModel.CancelEventArgs) _
Handles MyBase.Closing
Enter the
next menu
Enter first name
command in
the File menu
Shortcut Keys