home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   comp.lang.visual.basic      MS Visual Basic discussions, NOT dot-net      10,840 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 9,145 of 10,840   
   James L Hill to hennie   
   Re: TextBox Error   
   14 Jan 05 19:04:16   
   
   From: james.hill83@verizon.net   
      
   Try this for allowing only numeric input into a text box:   
      
   Private Sub Text1_KeyPress(KeyAscii As Integer)   
   Const iNumber = "1234567890"   
   If InStr(iNumber, Chr(KeyAscii)) <> 0 Then   
   Exit Sub   
   Else   
   KeyAscii = 0   
   End If   
   End Sub   
      
   The Keypress method of the textbox is called when you type in anything.   
   Setting the value of KeyAscii to 0 kills the enter.   
   "hennie"  wrote in message   
   news:cs8ql0$ele$1@reader08.wxs.nl...   
   > Hello,   
   > I've define a TextBox As Byte. Only numeric can be the input. I have made   
   a   
   > ErrorCheck().   
   > The problem next:   
   >   
   > If Val(Form1.txtText1.Text) "This is the problem" is not a byte Then   
   > etc.   
   >   
   > What do i have to fill in by: This is the problem is not a byte   
   >   
   > I have try <> Byte, but this doesn't work.   
   > I can the input define As String or something but I want only numeric that   
   > can input.   
   >   
   > Can someone help me, Thanks   
   >   
   >   
   >   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca