Dreevoo.com | Online Learning and Knowledge Sharing
 
Home | Programs | Programming languages | Visual Basic | How to use message box
Guest
Click to view your profile
Topics
Programs
Languages
Recipes
Home
Shortcuts
 
 

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.

 
  Author: mat | Version: 2010 | 1st November 2011 |  
 
 
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.

 
 
 
   
  Please login to post a comment
  Click to open user profile  
philipslangua, 25th Jan 2024, 3:09 AM
People can debate a wide range of issues on the website. This is fantastic. The Soccer Random game is prepared to immerse the player in a universe where finding the basket turns into an exhilarating journey. Highlighted by the captivating cadence of exceedingly difficult time constraints https://soccerrandom.io
 
 
  Click to open user profile  
garwin12i8, 25th Jan 2024, 12:18 PM
Changing your life with suitable decisions. That's the way life game working. https://bitlife.online/
 
 
  Click to open user profile  
dotsardonic, 22nd Feb 2024, 5:05 AM
On the website, people can discuss a variety of topics. This is outstanding. https://scratchgeometrydash.com
 
 
  Click to open user profile  
common, 3rd May 2024, 12:48 PM
Ok
 
 
  Click to open user profile  
ivymichael, 16th May 2024, 9:01 AM
see more
 
   
 
 
online learning made for people
Dreevoo.com | CONTRIBUTE | FORUM | INFO