google.com, pub-4617457846989927, DIRECT, f08c47fec0942fa0 Learn to enjoy every minute of your life.Only I can change my life.: Visual Basic Examples

Saturday, July 20, 2013

Visual Basic Examples


Program 1:- To create Visual Basic application to find the area of rectangle.


Code:-
 Private Sub Command1_Click() Text3.Text = Text1.Text * Text2.Text End Sub

Private Sub Command2_Click()

Text1.Text = " " Text2.Text = " " Text3.Text = " " End Sub


/*************************Output**************************/





Program 2:- To create Visual Basic application to average of 3 numbers.
Design Window:-

Code:-

Private Sub Command1_Click()

Text4.Text = Str((Val(Text1.Text) + Val(Text2.Text) + Val(Text3.Text)) / 3)

End Sub

Private Sub Command2_Click()

Text1.Text = " "

Text2.Text = " "

Text3.Text = " "

Text4.Text = " "

End Sub

Private Sub Command3_Click()

Unload Me

End Sub


/*************************Output**************************/



Program 3: To create Visual Basic application to illustrate Date-Time functions.

Code:-

Private Sub Command1_Click ()

Text1.Text = Date

Text2.Text = Time ()

Text3.Text = Year (Date)

Text4.Text = Month (Date)

End Sub

/*************************Output**************************/



Program 4:-To create Visual Basic application program to find maximum number among two numbers.

Code:-

Private Sub Command1_Click ()

Dim a As Integer

Dim b As Integer

a = Val(Text1.Text)

b = Val(Text2.Text)

If (a > b) Then

        Label3.Caption = "a is maximum number"

Else

        Label3.Caption = "b is maximum number"

End If

End Sub


/*************************Output**************************/

Program 5:-To create Visual Basic application program to perform arithmetic operations with the use of Option button.

Code:

Private Sub Option1_Click ()

Text3.Text = Val (Text1.Text) + Val (Text2.Text)

End Sub

Private Sub Option2_Click ()

Text3.Text = Val (Text1.Text) - Val (Text2.Text)

End Sub

Private Sub Option3_Click ()

Text3.Text = Val (Text1.Text) * Val (Text2.Text)

End Sub

Private Sub Option4_Click ()

Text3.Text = Val (Text1.Text) / Val (Text2.Text)

End Sub


/*************************Output**************************/



2 comments:

शिव भोलेनाथ स्तुति

 जय शिवशंकर, जय गंगाधर, करुणा-कर करतार हरे,   जय कैलाशी, जय अविनाशी, सुखराशि, सुख-सार हरे जय शशि-शेखर, जय डमरू-धर जय-जय प्रेमागार हरे,   जय ...