Walk Lightly on this PLANET and yet leave such a FOOTPRINT that cannot be erased for thousands of Years..!!!
Visit Codstech for Cyber Security related Posts !

Visitors

Friday, May 27, 2011

VB-12 : Set Focus(If-Then-Else-Endif)

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.


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: