It might be easier and cleaner to create a custom message box (just a new
form with some buttons and a Label or TextBox).
Once you have a new MsgBox, you can simply expose a public function in your
new message box to get rid of it.
If your event model is more structured, you may need to allow your MsgBox to
subsribe to events triggered by other modules:
Someone (May not be the MsgBox) defines the event:
Public Event EventYourSubscribingTo()
New MsgBox Handles the event:
AddHandler EventYourSubscribingTo, AddressOf RoutineToDoTheWork
You can trigger your cancellation with an appropriate "RaiseEvent".
RaiseEvent EventYourSubscribingTo
<milo phipps> wrote in message news:uO**************@TK2MSFTNGP12.phx.gbl...
? You are creating the message box within the thread? So the thread is
blocked until the user responds to the message box. I'm not sure I
understand why you need to "cancel" the message box. Surely, the message
box dissapears when the user clicks Okay?
It would, yes, but I need to cancel the msgbox from the other thread
if a certain something happens (and the user has not pressed "Ok" )
Is that clear now?