MTSkull
Well-known member
On the start up procedure for my application I have created 2 custom message box style forms.
One is a dialog form that pops up (using show()) displays status (no Buttons) then goes away. All controlled through code.
Two is a message box style form that has buttons and messages It pops up as a modal (showdialog()).
The error comes in my start up. I call the dialog window and start displaying messages "Connecting to Server" then I start my ado connection which I put in wrong to test the error handler, which writes to a log file then calls the procedure to display the second message box. This where the error is occuring. When I call the formModal.ShowDialog() the form Pops up for a second then disappears again. If I break on the following statment then move then execution line back to the showDialog statment it works the second time it runs. All the other forms I open with show dialog work fine.
One is a dialog form that pops up (using show()) displays status (no Buttons) then goes away. All controlled through code.
Two is a message box style form that has buttons and messages It pops up as a modal (showdialog()).
The error comes in my start up. I call the dialog window and start displaying messages "Connecting to Server" then I start my ado connection which I put in wrong to test the error handler, which writes to a log file then calls the procedure to display the second message box. This where the error is occuring. When I call the formModal.ShowDialog() the form Pops up for a second then disappears again. If I break on the following statment then move then execution line back to the showDialog statment it works the second time it runs. All the other forms I open with show dialog work fine.
Code:
opens form as modal then passes back which button the user selected
Public Function funShowMessageBox _
(ByVal strMessage As String, ByVal strTitle As String, Optional ByVal iButtons As Int16 = 2) As Int16
iButtons = 1 Go and Exit displayed
iButtons = 2 OK displayed Default value
Dim formModal As New frmMsgBox
Dim TempMsg As String
gstrMsgBoxMessage = strMessage
gstrTitle = strTitle
If iButtons > 2 Or iButtons < 1 Then
giMsgBoxButtons = 2 Set to default in case invalid
Else
giMsgBoxButtons = iButtons
End If
formModal.ShowDialog()
funShowMessageBox = giMsgBoxRtn
End Function