top of page

Introduction

3.

Introduction

4.

textbox, msgbox and button

Let's know what is textbox                     and button                     , and how we can use in our form.

Next Lesson

So use these two tools go to the toolbox and click and drag them on the form. (Figure 2.0)

Figure 2.0

Change the text of

button from its properties Figure 2.1

and figure 2.2 after click on button.

Figure 2.2

Figure 2.1

Then double click on button to go to the coding section.

Here Figure 2.3 some by default code if you

have confused about this code so don't

worry dude and go to my VB 2008 Tutorials

and watch that video because i have

already explain in detail about this

default code.

Figure 2.3

Now write this code which is show in Figure 2.4.

Figure 2.4

In this pitcher we are taking the addition of values of TextBox1 and TextBox2 in TextBox3.

in this code we need only values of textboxes so i have assign Val keyword which help to take

only values of textboxes, and we have assign .Text means that we want to assign text of Textbox1

and TextBox2 in the text of TextBox3. If you have any queries so you can message me or check

VB 2008 Tutorials. Then go to form1.vb [Design], and follow below steps to execute program.

1.

Click

start

Debugging.

3.

click 

calculate

button.

Figure 2.4.1

Figure 2.4.2

Figure 2.4.3

2.

enter

numbers.

Figure 2.5

Here figure 2.5 we have created three variables.

Dim a As Integer
Dim
b As Integer
Dim
c As Integer

this is the way to declare variable in VB.

after declare variable i have assign the value of TextBox1 inside the a variable and value of TextBox2 assign inside the b variable.

then assign a+b inside the c variable.

At the end, I will show the value of c through a message box (there are further arguments in message box which we will learn later but here we have passing c as argument which is show in message box). We will also show value of c in the TextBox. Follow Below steps.

Figure 2.5.1

Figure 2.5.3

1.

Click

start

Debugging.

2.

enter

numbers.

Figure 2.5.2

3.

Click on

calculate

button then

OK button

of msgbox.

Figure 2.5.4

4.

bottom of page