TextBox Values

A

Abdul

Hello!,

How I can limit textbox (or combo) from accepting only numbers and
Minimum is zero and maximum is Number of days in a specific month?

say for eg. In comboBox1 i select february then textBox1 shoul accept
only from 0 to 28 or in case of april 0 to 30, May 0 to 31 etc...

based on the value in textbox1 textbox2 is calculated, so textbox1
should not be allowed to be empty to avoid an error

thanks
 
R

raypayette

The simplest way for beginners is to validate the data once it is
entered.
Private Sub TextBox1_Change()
t = TextBox1.Text
If Not IsNumeric(t) Then MsgBox "Non numeric character "
End Sub

For experts, each keystroke can be monitored.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top