Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 11

Assignment1

Q1 Design an application to print in the message box welcome to visual basic

Private Sub Command1_Click () MsgBox ("welcome to vb") End Sub

Q2 Design an application to perform arithmetic operations of two numbers entered by the user

Private Sub add _ Click () Text3.Text = Val (Text1.Text) + Val (Text2.Text)

End Sub

Private Sub sub __ Click () Text4.Text = Val (Text1.Text) - Val (Text2.Text) End Sub

Private Sub divide _ Click () Text5.Text = Val (Text1.Text) / Val (Text2.Text) End Sub

Q3 Design an application when a user changes a text in the textbox the background color changes.

Private Sub Text1_Change () Form1.BackColor = black End Sub

Q4 Write a program to display the following messageshello, bye, and end

Private Sub Command1_Click () MsgBox ("hello ") + (Text1.Text)

End Sub

Private Sub Command2_Click () MsgBox ("bye ") + (Text1.Text) End Sub

Private Sub Command3_Click () End End Sub

Q5 Design an application to show the usage of different controls

Private Sub Label2_MouseDown (Button As Integer, Shift as Integer, X As Single, Y as Single) Text1.Text = ("down") End Sub

Private Sub Label1_MouseMove (Button As Integer, Shift as Integer, X As Single, Y as Single) Text1.Text = ("move") End Sub

Private Sub Label2_MouseUp (Button As Integer, Shift as Integer, X As Single, Y as Single) Text1.Text = ("up") End Sub

You might also like