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-10 : Set Focus(If-Then)

This program does not allow the user to move out of the text box till the user enters some value in it.
This example omits the ELSE and the END IF keywords.


A)   Property :
Text Box : NAME-Text1, TEXT-(Should be kept blank)

B)   Attaching Code to the Object :


Private Sub Text1_LostFocus()
If Text1.Text = " " Then MsgBox "Sorry!name cannot be left blank"
Text1.SetFocus
End Sub

Note : To run more than one line of code,we must includes the ENDIF statements.Refer VB-11 : Set Focus(If-Then-Endif) in which we are using ENDIF
==========================================

Refer : VB-11 : Set Focus(If-Then-Endif)

=========================================================================
Back to Home   &  VB

No comments: