clicked by the user in my Windows application:
Expand|Select|Wrap|Line Numbers
- .....
- Private Sub cmdRenew_Click(ByVal eventSender As System.Object, ByVal
- eventArgs As System.EventArgs) Handles cmdRenew.Click
- Try
- If x Is Nothing Then
- Exit Sub
- End If
- If y > 0 Then
- If z = 0 Then
- MsgBox("Random Message")
- Exit Sub
- End If
- Else
- Exit Sub
- End If
- If a Then
- MessageBox.Show("Random Message")
- Exit Sub
- End If
- If (b Or c) Then
- MsgBox("Random Message")
- Exit Sub
- Else
- If d Then
- ...
- If e Then
- MsgBox("Random Message")
- Exit Sub
- End If
- Else
- If f Then
- ...
- If g Then
- MsgBox("Random Message")
- Exit Sub
- End If
- Else
- MsgBox("Random Message")
- Exit Sub
- End If
- End If
- End If
- ''Problem Here
- If (h = 123) Then
- MsgBox("This Message Displays to the User while Done!
- MessageBox is also being Displayed")
- Exit Sub
- End If
- If i <> "" Then
- ...
- If j Then
- MsgBox("Random Message")
- Exit Sub
- End If
- If k Then
- ...
- Else
- If l Then
- ...
- Else
- ...
- End If
- End If
- ''Gets to here
- h = 123
- DoEvents()
- MessageBox.Show("Done!", "", MessageBoxButtons.OK)
- Else
- MsgBox("Random Message")
- End If
- Catch ex As Exception
- ErrorTrap(ex,
- System.Reflection.MethodInfo.GetCurrentMethod.Name, "")
- End Try
- End Sub
was displayed, but the Done! box would be displayed in the background
of the form and the user couldn't get to it withou ALT+TAB-ing to it. I
attempted to fix that and found that adding the DoEvents() call before
the Message Box was displayed fixed it, but now sometimes when the user
clicks the button, the Done! messagebox is displayed then the
MsgBox("This Message Displays to the User while Done! MessageBox is
also being Displayed") is displayed and locks up the whole program,
both that MEssage Box and the Done! message box are reached using the
ALT+TAB and the program freezes up. It seems as thought it runs through
the whole onclick, sets h = 123, displays the Done! message box, then
loops the onclick method again and gets to the h=123 check and sees it
now as true and displays that message box too.
Any thoughts, if it is the DoEvents() call that is causing it then does
anyone have a solution as to why the Done! message box is only
reachable using ALT+TAB by the user without the DoEvents() call?