Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
How to control TextBox ?
Hello all
I will have to develop a userform and I want to control the value of TextBox which must be an integer not null. What do I have to do? I wrote this but it is not the good code!! Private Sub TextBoxl_Change() Dim KeyAscii As MSForms.ReturnInteger Select Case KeyAscii Case Is < 49, Is 57 MsgBox "Only a non null interger is allowed." KeyAscii = Asc(Chr(8)) End Select End Sub |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
How to control TextBox ?
Private Sub TextBox1_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger)
Select Case KeyAscii Case Is < 49, Is 57 MsgBox "Only a non null interger is allowed." KeyAscii = 0 End Select End Sub -- HTH Bob (there's no email, no snail mail, but somewhere should be gmail in my addy) "Golenboy" wrote in message oups.com... Hello all I will have to develop a userform and I want to control the value of TextBox which must be an integer not null. What do I have to do? I wrote this but it is not the good code!! Private Sub TextBoxl_Change() Dim KeyAscii As MSForms.ReturnInteger Select Case KeyAscii Case Is < 49, Is 57 MsgBox "Only a non null interger is allowed." KeyAscii = Asc(Chr(8)) End Select End Sub |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
How to control TextBox ?
As a user, I wouldn't want to dismiss that dialog each time I made a typo. But
I liked the beep. I changed Bob's code to: Option Explicit Private Sub TextBox1_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger) Select Case KeyAscii Case Is < 49, Is 57 'MsgBox "Only an integer is allowed." KeyAscii = 0 Beep End Select End Sub Golenboy wrote: Hello all I will have to develop a userform and I want to control the value of TextBox which must be an integer not null. What do I have to do? I wrote this but it is not the good code!! Private Sub TextBoxl_Change() Dim KeyAscii As MSForms.ReturnInteger Select Case KeyAscii Case Is < 49, Is 57 MsgBox "Only a non null interger is allowed." KeyAscii = Asc(Chr(8)) End Select End Sub -- Dave Peterson |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Textbox input control? | Excel Programming | |||
How to move cursor from one textbox control to another textbox con | Excel Programming | |||
How to move cursor from one textbox control to another textbox con | Excel Programming | |||
Set Focus Problem for textbox control on multipage control | Excel Programming | |||
Set Tab to specific textbox control | Excel Programming |