<strong>In visual Basic customised textbox with requirement</strong>
If you want to make a textbox ot use like amount box then you should use below code in keypress event
event Start
If KeyAscii = 13 Then Command3.SetFocus: Exit Sub
If KeyAscii = 46 And InStr(Trim(Text1.Text), ".") <> 0 Then KeyAscii = 0
If KeyAscii = 8 Then Exit Sub
If KeyAscii = 46 Then Exit Sub
If IsNumeric(Chr(KeyAscii)) = False Then KeyAscii = 0
event end
Description:
First line:
when you press the Enter key then cussor got to youre pree define location.
2nd line :
if you use the . in text bos then second dot(.) you cant use.
3rd line :
If you press backspace the this will work for you and never forgot touse in your all text box keypress event
4th line :
single dot(.) will be allowed in textbox
5th line :
only numeric key will be allowed in textbox.
on all type of data entry you will need only change a 2nd and 4the line to make a customised textbox .
If you want to make a textbox ot use like amount box then you should use below code in keypress event
event Start
If KeyAscii = 13 Then Command3.SetFocus: Exit Sub
If KeyAscii = 46 And InStr(Trim(Text1.Text), ".") <> 0 Then KeyAscii = 0
If KeyAscii = 8 Then Exit Sub
If KeyAscii = 46 Then Exit Sub
If IsNumeric(Chr(KeyAscii)) = False Then KeyAscii = 0
event end
Description:
First line:
when you press the Enter key then cussor got to youre pree define location.
2nd line :
if you use the . in text bos then second dot(.) you cant use.
3rd line :
If you press backspace the this will work for you and never forgot touse in your all text box keypress event
4th line :
single dot(.) will be allowed in textbox
5th line :
only numeric key will be allowed in textbox.
on all type of data entry you will need only change a 2nd and 4the line to make a customised textbox .
No comments:
Post a Comment