Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Form not unloading
Message
From
01/07/2002 15:32:32
 
General information
Forum:
Visual Basic
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00674032
Message ID:
00674089
Views:
23
I fail to simulate your error - by me everything works fine. I create sample project with MDIForm and MDI child form. In second I put one command button and this code:
Dim mblnParsingRecords As Boolean
Dim mblnAbortImport As Boolean

Private Sub Command1_Click()

  Import
End Sub

Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
  
  If mblnParsingRecords Then ' we're parsing
    mblnAbortImport = True
    Cancel = 1
  End If
End Sub

Sub Import()

  mblnParsingRecords = True
  Do While True
    DoEvents
    If mblnAbortImport Then
      mblnParsingRecords = False
      Unload Me
      Exit Sub
    End If
  Loop
End Sub
Check this code and tell me if I ommit something in my simulation - if import procedure is in other module/form, if module-level variables are with different scope, etc.

The only idea for now - try to move clean-up code from import sub into MDI child form.

Plamen Ivanov
MCSD .NET Early Achiever and MCAD .NET Charter Member (VB .NET/SQL Server 2000)
MCSD (VB 6.0/SQL Server 2000)

VB (.NET) - what other language do you need in the whole Universe?...

Previous
Reply
Map
View

Click here to load this message in the networking platform