Visual Basic Assignment

You might also like

Download as doc, pdf, or txt
Download as doc, pdf, or txt
You are on page 1of 5

Assignment

No.1
Question 1
Design a Form with Caption “My First Program”
Set the backcolor (at Design Blue, at Load TIME Green, at Click White, at Unload
Pink)
Question 2
Write On the Form Left top Corner “Welcome to VB6.0” With window state
Maximized.

Question 3
Design a Form with all the button ie Minimize, Maximize & restore button is
no visible.
Question 4
Design a Form with only the Maximize button is disabled.

Question 5
Design a Form with cursor changes to the Hourglass when it comes to the Form.
Question 6
WAP to print the sum of two number (10 & 20) and their average like
sum=30, average=15 during :- (i)When the form is executed
(ii) When the button labeled PRINT is clicked.

--- CODING ---


'coding when form is executed 'coding when command button is clicked
Private Sub Form_Load() Private Sub Command1_Click()
Dim a, b As Integer Dim a, b As Integer
Dim sum, avg As Integer Dim sum, avg As Integer
a = 10 a = 10
b = 20 b = 20
sum = a + b sum = a + b
avg = sum / 2 avg = sum / 2
Form2.Show Form2.Show
Print "sum =" & sum Print "sum =" & sum
Print "avg =" & avg Print "avg =" & avg
End Sub End Sub

Question 7
WAP to print the name (First Name, Last Name as Full Name Using
Concatenation of string) when (i) when the mouse is pressed on the form
(ii) when the key is pressed.

--- CODING ---


'coding when the mouse is pressed on the form
Private Sub Form_Click()
Dim Fname, Lname As String
Dim Name As String
Fname = "ViPuL"
Lname = "BeNiwaL"
Name = Fname & " " & Lname
Form3.Show
Print Name
End Sub

'coding when the key is pressed


Private Sub Form_KeyPress(KeyAscii As Integer)
Dim Fname, Lname As String
Dim Name As String
Fname = "ViPul"
Lname = "BeNiwaL"
Name = Fname & " " & Lname
Form3.Show
Print Name
End Sub

You might also like