Visual BASIC Program Page 1

Visual BASIC Program Page 1

Visual BASIC Program Page 1

To view other topics related to Computer. Click Here.

Visual BASIC Program to find the greater value

Private Sub Command1_Click()

Dim a As Integer

Dim b As Integer

a = InputBox("Enter first value", "first value")

b = InputBox("Enter second value", "second value")

If a > b Then

MsgBox ("First value is greater")

Else

MsgBox ("Second value is greater")

End If

End Sub

Math Calculation Project

Private Sub cmdclear_Click()

Text1.Text = ""

Text2.Text = ""

Text3.Text = ""

Text1.SetFocus

End Sub


Private Sub cmdclos_Click()

Unload Me

End Sub


Private Sub cmdmulti_Click()

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

End Sub


Private Sub cmdsum_Click()

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

End Sub

Visual BASIC Program to multiply the two integers

Private Sub Command1_Click()

Dim a, b, c As Integer

a = InputBox("Enter 1st value", "input box")

b = InputBox("Enter 2nd value", "input box")

c = a * b

MsgBox a & "*" & b & "=" & c, -0, "Multiplication"

End Sub

Visual BASIC Program to print a message on the screen

Private Sub Command1_Click()

MsgBox "Testing messege", vbOKCancel + -vbExclamation, "messege box

window”

End Sub




Visual BASIC Program to find Hide/Show forms

Private Sub Command1_Click()

Form2.Show vbModeless

End Sub


Private Sub Command2_Click()

Form3.Show vbModeless

End Sub

Visual BASIC Program to find the got focus and lost focus

Private Sub Command1_GotFocus()

Command1.Caption = "Got Focus"

End Sub


Private Sub Command1_LostFocus()

Command1.Caption = "Lost Focus"

End Sub


Private Sub Command2_GotFocus()

Command2.Caption = "Got Focus"

End Sub


Private Sub Command2_LostFocus()

Command2.Caption = "Lost Focus"

End Sub


Private Sub Command3_GotFocus()

Command3.Caption = "Got Focus"

End Sub


Private Sub Command3_LostFocus()

Command3.Caption = "Lost Focus"

End Sub

Visual BASIC Program to find the events

Private Sub Form_Click()

Form1.Caption = "Form was clicked"

End Sub


Private Sub Form_DblClick()

Form1.Caption = "Form was double clicked"

End Sub


Private Sub Form_KeyPress(KeyAscii As Integer)

Form1.Caption = "Key was press on keyboard"

End Sub

Post a Comment

Previous Post Next Post