Visual Basic 6.0

Visual Basic 6.0

Slip14


Q.1) Write a VB Program to create a POPUP menu. Menu are Color (sub menu- red, green,
blue, yellow), Font (Times New Roman, Verdana, Arial Black etc), Font Size (10, 11,
12 etc) after clicking on particular menu changes should reflect on Label control.
[Marks 15]

Solution


Private Sub a_Click()
Label1.FontSize = 10
End Sub

Private Sub arial_Click()
Label1.FontName = "arial black"
End Sub

Private Sub b_Click()
Label1.FontSize = 12
End Sub

Private Sub blue_Click()
Label1.ForeColor = vbBlue
End Sub

Private Sub c_Click()
Label1.FontSize = 14
End Sub

Private Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = vbRightButton Then
PopupMenu pop, vbPopupMenuRightButton
End If
End Sub

Private Sub green_Click()
Label1.ForeColor = vbGreen
End Sub

Private Sub red_Click()
Label1.ForeColor = vbRed
End Sub

Private Sub time_Click()
Label1.FontName = "times new roman"
End Sub

Private Sub ver_Click()
Label1.FontName = "verdana"
End Sub

Private Sub yellow_Click()
Label1.ForeColor = vbYellow
End Sub


Output





Q.2) Write a menu driven program in VB for reservation & cancellation of tickets for an
airline. The menu should also contain an option for displaying the reservation details. The
program should ask for the no. of tickets that the user wants to book and category
(Business class, First class & Economy) use a ListBox control .Display number of tickets
booked, Category & total amount. The reservation details should display no. of tickets
booked at any instant of time category-wise. [Marks 25]


Solution

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

Private Sub Command1_Click()
Data1.Recordset.AddNew
End Sub

Private Sub Command2_Click()
Data1.Recordset.Update
MsgBox "BOOKIG SUCCESSFULL"
End Sub

Private Sub Command3_Click()
Data1.Refresh
Data1.Recordset.Delete
MsgBox "record delete successfull"
End Sub
Private Sub List1_Click()
a = 1500
b = 2000
c = 1800
If List1.Text = "first class" Then
Text4.Text = a
ElseIf List1.Text = "business" Then
Text4.Text = b
ElseIf List1.Text = "economy" Then
Text4.Text = c
End If
End Sub

Private Sub Text5_Click()
Text5.Text = Val(Text3.Text) * Val(Text4.Text)
End Sub

Output



BCA Pratical Solution

My name is Vivek And I from Mumbai and Complete my Graduation Bca.my Age is 23 Years.

Post a Comment

Previous Post Next Post