J
JB
Is there some polite way to cancel a dlg in the New() processing?
Private Sub OpenTheDlg
Dim dlg as New dlgGetAList(intID as Integer)
with dlg
If .ShowDialog= DialogResult.Cancel then
.dispose
return
end if
...
End Sub
In the dlg code
Friend Sub New(intID as Integer)
Me.New()
If False = CheckOnSomething(intID) Then
MsgBox( "nothing to process")
(First try)
Me.DialogResult = DialogResult.Cancel ' This just seems to be
ignored
' the
dlg continues to open
(Second try)
Me.Close ' the does kill the dlg but an exception is raised in
the calling
' sub on the line If .ShowDialog ....
End If
End Sub
What I want is implied by (First try) but it doesn't work. What I want is
to show the message box and then exit without the dlg ever becoming visible.
I also tried putting the test in the Load event and it does sort of work but
the dlg does flash on the screen after the msg box is closed. Any ideas?
Private Sub OpenTheDlg
Dim dlg as New dlgGetAList(intID as Integer)
with dlg
If .ShowDialog= DialogResult.Cancel then
.dispose
return
end if
...
End Sub
In the dlg code
Friend Sub New(intID as Integer)
Me.New()
If False = CheckOnSomething(intID) Then
MsgBox( "nothing to process")
(First try)
Me.DialogResult = DialogResult.Cancel ' This just seems to be
ignored
' the
dlg continues to open
(Second try)
Me.Close ' the does kill the dlg but an exception is raised in
the calling
' sub on the line If .ShowDialog ....
End If
End Sub
What I want is implied by (First try) but it doesn't work. What I want is
to show the message box and then exit without the dlg ever becoming visible.
I also tried putting the test in the Load event and it does sort of work but
the dlg does flash on the screen after the msg box is closed. Any ideas?