Jump to content

Is functions

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by Rathodbharat (talk | contribs) at 18:25, 19 December 2010 (Created page with 'For validation of numbers in VB6 we can use function like '''IsNumeric()''' which text field as argument for which validation will be perform. Example: ''' ''Priva...'). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.
(diff) ← Previous revision | Latest revision (diff) | Newer revision → (diff)

For validation of numbers in VB6 we can use function like IsNumeric() which text field as argument for which validation will be perform.

Example: Private Sub txtcodeno_Change() If Not IsNumeric(txtcodeno.Text) And txtcodeno.Text <> "" Then txtcodeno.Text = "" lblerror1.Visible = True Else lblerror1.Visible = False end if endsub

Where:

txtcodeno = Name of textbox on which validation will be perform
lbderror  = Name of label will visble  true (default false)if characters or other   symbols    except numbers will be enter in txtcodeno filed

DESCRIPTION OF ABOVE CODE:

Take one [[1]] on form and give its name to txtcodeno. Take one label and set its name to lblerror1 and make its visible properties to false ans set caption to "Enter only numbers". Write above code in change event of txtcodeno textbox. Make visble propertis of lblerror1 to false in lostfocus even of txtcodeno textbox. OUTPUT:

When you will enter except numbers then you will get visible lable with message "Enter only numbers" and txtcodeno will clear.

THANK YOU.