MessageBox does not display 'tex't unless I add extra code.

K

Kevin R

I'm running the HelloWorldForm example from Microsoft to learn how to use
..net. I'm using Microsoft Visual Studio .NET 2003, 1.1 framework.

I run the HelloWorldForm example. The example runs but the text "Disposed!"
does not appear on the MessageBox. I can get the text to display if I add
aditional MessageBox switch options. Is there a reference or something I'm
missing so I don't have to add these options everytime I use the MessageBox?

Thanks!

Kevin R.
==========
Here is the code in the example:
'Called when the Form closes
'Note that the MessageBox call is simply to
'demonstrate that Dispose is called.
'You should keep your Dispose method code as simple and robust as possible

Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
Try
MessageBox.Show("Disposed!")
Catch ex As Exception
End Try
MyBase.Dispose(disposing)
End Sub

I modified the code as follows to display the "Disposed" text message.

MessageBox.Show("Disposed!", "Caption", MessageBoxButtons.OK,
MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1,
MessageBoxOptions.DefaultDesktopOnly)
 
C

Chris R. Timmons

I'm running the HelloWorldForm example from Microsoft to learn
how to use .net. I'm using Microsoft Visual Studio .NET 2003,
1.1 framework.

I run the HelloWorldForm example. The example runs but the text
"Disposed!" does not appear on the MessageBox. I can get the
text to display if I add aditional MessageBox switch options.
Is there a reference or something I'm missing so I don't have to
add these options everytime I use the MessageBox?

Kevin,

It runs fine on my system (same setup as yours). Try removing the
try/catch handler code. If an exception is occurring when the
message box code executes, the empty try/catch handler will not allow
the error message to be displayed.


Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
MessageBox.Show("Disposed!")
MyBase.Dispose(disposing)
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top