If you do this
'the public sub define is not correct, when you double click on textbox and
go to code add the event onchange
Public sub TextBox_Change( byval sender, byval e)
try
try
if((microsoft.v isualbasic.righ t(cint(e.text), 1) <= 2)) and
((microsoft.vis ualbasic.right( cint(e.text),1) >= 9) then
'if you want to make sure that the user does not have 'a
number larger then 12
if((cint(e.text )< 12) and (cint(e.text)>= 2))then
'number betweeen 2 and 12
else
'number not between 2 and 12
me.textbox.text = microsoft.visua lbasic.left
(me.textbox.tex t,(LEN(me.textb ox.text)-1))
end if
else
me.textbox.text = microsoft.visua lbasic.left
(me.textbox.tex t,(LEN(me.textb ox.text)-1))
end if
end if
catch
'number was not entered
me.textbox.text = microsoft.visua lbasic.left
(me.textbox.tex t,(LEN(me.textb ox.text)-1))
end try
catch ex as
end try
end sub
"Steve" <kg******@hotma il.com> wrote in message
news:%2******** ********@TK2MSF TNGP10.phx.gbl. ..
I am new to vb.net. I have a textbox. I want the user to be able to only
enter numbers between 2 and 12 into the textbox. Is there a way to do
this? Thanks for any help.