Visual BASIC Program Page 2
To view other topics related to Computer. Click Here.
Visual BASIC Program to find check box events (Fruit Shop)
Private Sub Command1_Click()
Dim str As String
str = ""
If Check1.Value = 1 Then
str = str & Check1.Caption & Chr(13)
End If
If Check2.Value = 1 Then
str = str & Check2.Caption & Chr(13)
End If
If Check3.Value = 1 Then
str = str & Check3.Caption & Chr(13)
End If
MsgBox "You have selected :" & Chr(13) & str
End Sub
Visual BASIC Program to enter password
Private Sub cmdvalid_Click()
Dim response As Integer
If txtpassword.Text = txtpassword.Tag Then
MsgBox "valid password", vbOKOnly + -vbExclamation, "Access Allowed"
Else
response = MsgBox("incorrect password", vcbRetrycancel - vbCritical, "Access Denied")
If response = vbRetry Then
txtpassword.SelStart = 0
txtpassword.SelLength = Len(txtpassword.Text)
Else
End
End If
End If
txtpassword.SetFocus
End Sub
Visual BASIC Program to display time on the screen
Private Sub Timer1_Timer()
Label1.Caption = Time
End Sub
Write BASIC Program to find label events
Private Sub Command1_Click()
Label1.Caption = Command1.Caption
End Sub
Private Sub Command2_Click()
Label1.Caption = Command2.Caption
End Sub
Visual BASIC Program to find inner/outer loop(nested loops)
Private Sub Command1_Click()
For outerloop = 1 To 3
Print "Outerloop counter variable ="; outerloop
For innerloop = 1 To 2
Print "innerloop counter variable="; innerloop
Next innerloop
Next outerloop
End Sub
Visual BASIC Program to display first ten odd no
Private Sub Command1_Click()
Dim r As Integer
Dim n As Integer
n = 1
Do
r = n Mod 2
If r = 1 Then Print n
n = n + 1
Loop Until n > 10
End Sub
Visual BASIC Program to enter the password?
Private Sub cmdexit_Click()
End
End Sub
Private Sub cmdvalid_Click()
Dim response As Integer
If txtpassword.Text = txtpassword.Tag Then
MsgBox "Valid password", vbOKOnly + -vbExclamation, "Access Allowed"
Else
response = MsgBox("Incorrect Password", vbRetryCancel - vbCritical, "Access Denied")
If response = vbRetry Then
txtpassword.SelStart = 0
txtpassword.SelLength = Len(txtpassword.Text)
Else
End
End If
End If
txtpassword.SetFocus
End Sub
Private Sub Form_Activate()
txtpassword.SetFocus
End Sub
Visual BASIC Program To display the time on the screen?
Private Sub Timer1_Timer()
Label1.Caption = Time
End Sub
Post a Comment