Sometimes you have to run certain statements IF A condition is true and run others IF A condition is false.
Then you can use an IF...THEN.....ELSE statement to define two blocks of executable ststements:
One block to run if the condition is TRUE,
and the other block to run if the condition is FALSE.
Refer : VB-10 : Set Focus(If-Then)
=========================================================================
Back to Home & VB
Then you can use an IF...THEN.....ELSE statement to define two blocks of executable ststements:
One block to run if the condition is TRUE,
and the other block to run if the condition is FALSE.
A) Property :
Textbox |
B) Attaching Code to the Object :
Private Sub Text1_LostFocus() If Text1.Text = " " Then MsgBox "Sorry!name cannot be left blank" chance = chance + 1 Text1.SetFocus Else MsgBox "Great!name was successfully entered" End If End Sub |
Refer : VB-10 : Set Focus(If-Then)
Back to Home & VB
No comments:
Post a Comment