Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

MDI forms can't be Modal

Posted on 2004-09-02
2
Medium Priority
?
140 Views
Last Modified: 2010-05-02
In the following code "frmMain" is a MDI form. Since MDI forms can't be Modal, the execution of the code will continue to "GlobalErrorHandlerDestroy" and deactivate
my error handler as quickly as it has been activated. Is there any workaround? In other words, I only want "GlobalErrorHandlerDestroy" to be exexuted when the
program is being terminated (fMain being closed).

Public Sub Main()
Const csSUBNAME As String = "main"
On Error GoTo ErrorHandler

    GlobalErrorHandlerCreate
   
    Set fMain = New frmMain
       
    fMain.Show  '(VBModal can be used here)
 
    GlobalErrorHandlerDestroy
   
Exit Sub
ErrorHandler:
    If go_Err Is Nothing Then
        MsgBox "Could not initialise error handler.", vbCritical
    Else
        If go_Err.ErrReport(Err, Erl, csMODULENAME, csSUBNAME) Then Resume
    End If
End Sub
0
Comment
Question by:inorse
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 22

Expert Comment

by:DarkoLord
ID: 11967594
One way would be to create another function and call it from frmMain when it is being closed....

Darko
0
 
LVL 32

Accepted Solution

by:
Erick37 earned 750 total points
ID: 11968173
Why not set frmMain as your startup form.  Then create your error handler in MDIForm_Load and destroy it in MDIForm_Unload?
0

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses

704 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question