Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Textbox members

Status
Not open for further replies.

JohnStep

Programmer
Apr 19, 2000
190
0
0
US
What property is it which you state the members that can populate a textbox. Let's say I want numbers only 0-9 with no Alpha. Which property is it that accepts only numberals??
 
There is no property on the standard textbox control. You will want to use the MaskEdit control (avail through Project... Components...)

 
Or you can also use the Keypress event to make a decision about whether or not to allow a key.
 
Thanks for the reply. I had some old code I forgot about that does the same thing. I did...

Private Sub Text1_Change()
Rem** Ensures that only numbers are entered **

If Not IsNumeric(Text1.Text) And Text1.Text <> "" Then
Text1.Text = ""
End If
End Sub
 
The problem with that code is that if the user types in

999 and then accidentally pushes a non numeric character (which will happen a lot) then their whole string is erased.

If you want to use key trapping then use the KeyPress event as mmilan suggested.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top