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,936 of 10,840   
   code_wrong to tac@tac.co.uk   
   Re: visual basic input validation intege   
   02 Mar 06 17:48:49   
   
   XPost: comp.programming   
   From: tac@tac.co.uk   
      
   "code_wrong"  wrote in message   
   news:4404ac4c$1_3@mk-nntp-2.news.uk.tiscali.com...   
   > Visual Basic (not dot net)   
   > what is the best way to check the User has entered an integer into an   
   > InputBox?   
   >   
   > isNumeric() checks for a numeric value .. but does not notify of numbers   
   > with decimal places   
   > inputBox returns a string so I could check for decimal point??? this seems   
   > like overkill   
   >   
   > The value returned can be asigned into an Integer type and then a Single   
   > type ... the two can be compared .. but still this does not complain about   
   > numbers with decimal places if the fractional part is zero   
   >   
   > what is the simple solution?   
      
   Interesting discussion , thanks for the replies.   
   I have decided to provide students with a pre-defined function of my own   
   design   
   please review and improve if you can   
   the function:   
      
   Function isInteger(strVal As String) As Boolean   
      
       'if not numeric or decimal point found   
       If Not IsNumeric(strVal) Or InStr(strVal, ".") Then   
           isInteger = False   
       Else   
           isInteger = True   
       End If   
      
   End Function   
      
   --- 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