Creating Your VB project in Visual Basic 2008/2010/.NET - VB Tutorials - Basics

First Application in Visual Basic 2008
Click on Start button on the task bar or the Window logo in Vista
Click on All Programs
Click on Visual Basic 2008 Express Edition logo.
On the Start page of the application, click on Create project:



After you click on Create Project this window will pop up:

More Visual basic Codes:-
Phone Book Application Program 
Creating a Log In Application Program In Visual Basic 2008
Analog Clock In Visual Basic 2008/2010/.NET




Click on the first icon Windows Forms Application, and name your first application and then click ok.

Now you can see a small form on the corner of the application, and the controls on its left.



Let's add a text box:
A text box is a text area that allows the user to enter text.
In the Tool Box on the left, click on TextBox
Draw a shape on the form to draw the TextBox.




After placing the TextBox on the form, you can move anywhere on the Form.
Now insert a label.
Find the Label control from the Tool Box and place it on the Form.




Name the Label1 "Name". To do that right click on Label1, click on Properties
The Properties window will appear on the right.
Change the property of Text to Name:



Add a new Textbox and a new Label and a button as the picture below, and name the second change the new label's text properties to Last and the button's text to Get Name:



Here comes the fun part: WRITING THE CODE
Double click on the new button that says "Get Name" to go to the codes page.
You will see a code like this:

Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)Handles Button1.Click
End Sub
End Class

Now we will tell the form to produce a message box and show the name and the last name when we click on "Get Name"

You will enter this code between the second line and the third line:

MsgBox("My Name is " & TextBox1.Text & " " & TextBox2.Text)

After adding this code go to Build, Publish WindowsApplication1. (If you named this application something else, it's going to appear instead of WindowsApplication1.

Now enter a name inside the first textbox, and a last name inside the second textbox, and then click on "Get Name" and you should get something like this:

Now this is a very simple application to get you started .

Did you see how easy we built this application. You entered the controls easily, part of the code was generated by itself, and you added a very small piece of code.You might wonder how and where did we get the code from. Well let's analyze how we came out with that code.Since that the program generates part of the code for us, let's not worry now how the software does that. Let's look at the code we wrote:

MsgBox("My Name is " & TextBox1.Text & " " & TextBox2.Text)

MsgBox: We told the program to display a message box that tells us whatever we entered in the form.

Write after MsgBox notice that we added ( . Whatever we enter between the two parenthesis is going to show on the message box. There are two kinds to show the text: directly and indirectly. If a text is entered between 2 quotations mark like: "My Name is " is shown exactly as is. Now we wanted to show what inside the text area that the user enters on the form. We added & TextBox1.Text , that means we wanted to show the text in the first text box that is named Textbox1 by default.

Related

Visual Basic 2008 5091463957197280403

Post a Comment

SPAMMING will not be Appreciated.

emo-but-icon

Hot in week

Recent

Comments

Our Channel

Contact Us

Name

Email *

Message *

item