Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Textbox input control? Rbp9ad[_2_] Excel Programming 1 November 9th 05 07:00 PM
How to move cursor from one textbox control to another textbox con Tom Ogilvy Excel Programming 1 September 16th 04 03:42 PM
How to move cursor from one textbox control to another textbox con KMoore007 Excel Programming 0 September 16th 04 02:47 PM
Set Focus Problem for textbox control on multipage control ExcelDeveloperSPR Excel Programming 1 July 16th 04 08:54 PM
Set Tab to specific textbox control mandy_less[_3_] Excel Programming 3 September 23rd 03 08:40 AM


All times are GMT +1. The time now is 03:51 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"