cancel
Showing results for 
Search instead for 
Did you mean: 

Error when close the application before the selection dialog is closed

Valued Contributor
Valued Contributor

I have a Form1 as the main application and 

Dim dialog = Snap.UI.Selection.SelectObject("")

is open.  Sometimes, I forget to close the 

dialog 

first but the Form1 first.  And I get this error message, the NX is forced to close. How can I deal with this?

 

 

Capture.PNG

 

Thanks

1 REPLY

Re: Error when close the application before the selection dialog is closed

Valued Contributor
Valued Contributor

I have a solution for this one

 

1. I added code to disable the close "X" on the Form1

 Private Const CP_NOCLOSE_BUTTON As Integer = &H200
    Protected Overloads Overrides ReadOnly Property CreateParams() As CreateParams
        Get
            Dim myCp As CreateParams = MyBase.CreateParams
            myCp.ClassStyle = myCp.ClassStyle Or CP_NOCLOSE_BUTTON
            Return myCp
        End Get
    End Property

2. Then I added an Exit Button

   Me.Dispose()

3. In the code for open dialog

'Begin Code
btExit.Enable = False



'End Code
btExit.Enable = True

This force the user to close the dialog