Escolar Documentos
Profissional Documentos
Cultura Documentos
Visual Basic 2010 is the latest version of Visual Basic launched by Microsoft in 2010. VB2010 is almost similar to
Visual Basic 2008, but it has added many new features. Like Visual Basic 2008 , Visual Basic 2010 is also a full
fledged Object-Oriented Programming(OOP) Language, so it has caught up with other OOP languages such as C++,
Java,C# and others. However, you don't have to know OOP to learn VB2010. In fact, if you are familiar with Visual
Basic 6, you can learn VB2010 effortlessly because the syntax and interface are similar. Visual Basic 2010 Express
Edition is available free for download from the Microsoft site. Click on this
link http://www.microsoft.com/express/downloads/ to download Vb2010. The Integrated Development Environment
when you launch VB2010 Express is shown in the diagram below. The IDE Start Page consists of a few sections,
namely:
The Recent Projects section that shows a list of projects that have been created by you recently.
The Getting Started Pane- It provides some helpful tips to quickly develop your applications.
The Latest News section- It provides latest online news about Visual Basic 2010 Express. It will announce
new releases and updates
To start creating your first application, you need to click on New Project. The following VB2010 New Project dialog box
will appear.
Controls
To insert a control into your form, you just need to drag the
control and drop it into the form. You can reposition and resize
it as you like. Lets examine a few programs that made use of
Button, Label, TextBox , ListBox and PictureBox . You don't
have to worry so much about the code because I will explain the
program syntax as you progress to later lessons. When you click
on the Toolbox tab, the common controls Toolbox will appear.
To create your first program, drag the button control into the form, and
change its default Text Button1 to OK in the properties window, the
word OK will appear on the button in the form, as shown below:
Now click on the OK button and the code window appears. Enter the code as follows:
When you run the the program and click on the OK button, a dialog box will appear and display the "WELCOME TO VISUAL BASIC
2010" message,as shown below:
There you are, you have created your first VB2010 program.
Next I will show you how to create a simple calculator that adds two numbers using the TextBox control. In this program, you
insert two textboxes , three labels and one button. The two textboxes are for the users to enter two numbers, one label
is to display the addition operator and the other label is to display the equal sign. The last label is to display the
answer. Now change the label on the button to Calculate,then click on this button and enter the following code:
num1 = TextBox1.Text
num2 = TextBox2.Text
Label1.Text = product
End Sub
When you run the program and enter two numbers, pressing the calculate button can let you perform addition of the
two numbers.