Visual Basic 6.0

Visual Basic 6.0

Slip30

Q.1) Write a VB program to create a form with a combo box having list of cities and 3
command buttons as ADD , DELETE and EXIT. ADD button will add a new city in the
combo box, DELETE will delete the selected city and EXIT will end the program.
[Marks 15]

Solution

Private Sub Command1_Click()
Combo1.AddItem (Text1.Text)
Text1.Text = ""
Text1.SetFocus
Combo1.Text = Text1.Text
End Sub

Private Sub Command2_Click()
Dim n As Integer
n = Combo1.ListIndex
If n >= 0 Then
Combo1.RemoveItem (n)
End If
End Sub

Private Sub Command3_Click()
Unload Me
End Sub

Private Sub Text1_Change()
Command1.Enabled = (Len(Text1.Text) > 0)
End Sub

Output




Q.2) Write a program in VB for Login screen validation.(use ADODC Control)
[Marks 25]

Solution

Private Sub Command2_Click()
Do Until Adodc1.Recordset.EOF
If Adodc1.Recordset.Fields("uname").Value = Text6.Text And
Adodc1.Recordset.Fields("upass").Value = Text7.Text Then
Form1.Hide
Form2.Show
Exit Sub
Else
Adodc1.Recordset.MoveNext
End If
Loop
Msg = MsgBox("Invalid password, try again!", vbOKCancel)
If (Msg = 1) Then
Form1.Show
Text6.Text = ""
Text7.Text = ""
Else
End
End If
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