Message Box in Visual Basic

Hi buddy of Bluespedia, in the previous tutorial we have learned about how to open / run Visual Basic and Creating a Project, this time we will learn to create a program in Visual Basic, this tutorial I created for you who are just learning Visual Basic, we would make an Introduction Program of Visual Basic, and when we click an icon will display a message with your name, before we beginning to make its program, open the Visual Basic first and create a program with Standard EXE project, if its already : the first thing is add label, Command Button, and Text Box, set so like this:


to add it, click one of toolbox icon and then click on the Form Object and drag to set the width, for label icon depicted with a capital letter A, whilst the Text Box depicted with lowercase ab, and Command button depicted with the button, in the following picture:


If it had been the second step of changing the Caption and text, so like this:


To change this, click component in the Object Form and then in property line option way means Caption (for Command Button and Label) or text (for Text Box), set and adjust the caption so that as shown above.


Third step, move to form Code (click 2 times Form Object), or double-click the command button, and then enter the following script:

Private Sub Command1_Click () 'Beginning Script
MsgBox ("My Name" + Text1. Text + ", and I medium learning visual basic"), vb
Information, "Visual Basic" 'script
End Sub 'End of Script

The purpose of the scrip above is when command1 clicked (Private Sub Command1_ Click ()) will display a message box (msg box), "My Name (word / name that is in the text box) and I'm Learning Visual Basic, with type of the message "Information" (vb Information), the name / reason (or whatever) "Visual Basic".

If it is correct then you should check it out, to check press F5 or play icon on the toolbar rows, like this:
Icon Play, Pause dan Stop di Visual Basic
This is a picture when the project is running :


if the program was run, you try to click the command button "Click Here", then when clicked will display a message as it has been written in script,


to terminate the program click stop icon on the toolbar, don't forget to save and name the project with a name that is easy to remember and of course highly correlated with project that created, to save, same like other software, just click CTRL + S or click menu File > Save, then select / point to a place where the project will be saved.

That’s simple program about Introduction to Visual Basic, for the next tutorial we will learn to create advance visual basic program, and therefore still visit the Blues Pedia That is all and thank you

Popular Posts