VB6 beginners tutorial - Learn VB6

Advanced VB6 tutorial - Learn Advanced VB6

Systems Analysis - System analysis and Design tutorial for Software Engineering

You are here: Visual Basic > Advanced VB6 tutorial > Chapter 14

Limitations of Modeless Forms in an Active Document Project

Your Active Document project may contain forms as well as UserDocument objects because you might want to display these forms as part of the functioning of your Active Document application. There are two situations when you can't display modeless forms, however:

  • An Active Document project compiled as a DLL cannot use modeless forms. Only Active Document EXE projects can use modeless forms at all.

  • Some container types will not support modeless Forms in any type of Active Document regardless of whether the underlying application is an EXE or DLL. At the present writing, for instance, Internet Explorer 4.0 and components of MS Office 97 and higher will support modeless Forms in Active Document EXEs, but Internet Explorer 3.x will not (it causes a runtime error). Your UserDocument's code can determine whether or not its current container supports modal forms by checking the value of App.NonModalAllowed. If its value is True, you can go ahead and display a form modelessly. Otherwise, better not display the form or display it as a modal form (see Listing 14.10).


Private Sub cmdShowData_Click()
If App.NonModalAllowed Then
frmData.Show vbModeless
frmData.Show vbModal
End If
End Sub

As a general rule, it's safest to always display forms modally even in an ActiveX EXE.


<< Previous | Contents | Next >>

Home | About Us | Privacy Policy | Contact Us

Copyright © | All Rights Reserved