Wednesday, December 12, 2012

Differentiate model and modeless dialog box


You can show forms from code component classes just as you would in a standard Visual Basic project—you use the Show method:
FormName.Show [ style [, ownerform]]
Here are the arguments for Show:
style—Integer that determines if the form is modal (vbModal = 1) or modeless (vbModeless =
0).
ownerform—String that specifies the component that owns the form you want to show (for
instance, you can use the keyword Me here)
In Visual Basic, Forms are shown as modal or modeless (default). A Form displayed in modal form prevents the user from accessing any other Forms in the current program (project) until she has responded to the active Form:
Private Sub mnuHelpAbout_Click()
frmAbout.Show vbModal
End Sub
Forms shown with the modeless type do not prevent the user from switching to other Forms in the application:
Private Sub mnuHelpAbout_Click()
frmAbout.Show vbModeless
End Sub