|
|
|
|
How to use message box
Message boxes can be used for numerous of things, let's see how to make it appear as warning or confirmation box.
|
|
 |
|
|
|
|
|
 |
|
 |
|
 |
 |
1.
|
|
|
Start the Microsoft Visual Basic 2010 and open a new Windows Form Application project.
|
|
|
2.
|
|
|
Choose TextBox on the left and click the Form to add it.
|
|
|
3.
|
|
|
Now choose the Button on the left and add bellow the TextBox.
|
|
|
4.
|
|
|
You can change text on the button by clicking the Text field in the Button's properties (see picture).
I've changed it to OK.
|
|
|
5.
|
|
|
Now double click the Button to go to the code entry form.
Click the empty row bellow Private sub ...
|
|
|
6.
|
|
|
... and put in or copy paste the following code:
If TextBox1.Text = "dreevoo.com" Then MsgBox("Knowledge is for sharing.") Else MsgBox ("Please enter dreevoo.com") End If
MsgBox ("text") is the procedure that makes the Message Box appear on your screen.
In our case, if we put "dreevoo.com" in the TextBox and click OK button, we get the confirmation message box saying "Knowledge is for sharing"). If we put anything else in the TexBox we get a "warning" message saying we should put in "dreevoo.com".
|
|
|
7.
|
|
|
Try it out and see it for yourself.
Click Start Debugging (F5) button to start your little app.
|
|
|
8.
|
|
|
Enter anything but dreevoo.com and click OK.
You should receive 'Please enter dreevoo.com' message.
Click OK.
|
|
|
9.
|
|
|
Now enter dreevoo.com and click OK.
You should get the 'positive' message saying 'Knowledge is for sharing' or what ever you put in there.
Want to know more? Please use the Forum.
|
|
|
 |
 |
 |
|
 |
|
|