Visual Basic .NET » Visual Basic .NET General Discussion
Problem with message box -- legion --

I have to try start learning Visual Basic .NET. I have made my first hello world program. But when I run it..there is an error.


Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
MessageBox.Show("Hello World", "Test", MessageBoxButtons.OK, MessageBoxIcon.Hand, MessageBoxDefaultButton.Button1, MessageBoxOptions.RightAlign, True, "hello")
End Sub
End Class
 

Sorry for my newbie question..
Message Box Problem -- doremi --

I think you must learn how to display message box.

In .NET Framework there are many overload list how to display message box.

The easy one is :
MessageBox.Show (String)  

this for displays a message box with specified text.

Or you can use:
MessageBox.Show (String, String)  

this for displays a message box with specified text and caption.

If we look your codes, it think you use this overload :
MessageBox.Show (String, String, MessageBoxButtons, MessageBoxIcon, MessageBoxDefaultButton, MessageBoxOptions, String, HelpNavigator, Object)  

this for displays a message box with the specified text, caption, buttons, icon, default button, options, and Help button, using the specified Help file, HelpNavigator, and Help topic.

If you use above overload, your code must be like this:
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
MessageBox.Show("Hello World", "Test", MessageBoxButtons.OK, MessageBoxIcon.Hand, MessageBoxDefaultButton.Button1, MessageBoxOptions.RightAlign, True, "hello", "2", "2")
End Sub
End Class 
Overload list of message box -- legion --

@Doremi, thank you for your great reply. I have learn much now.

I think for simple one I should use: MessageBox.Show (String, String)
[Submit Comment]Home