home bbs files messages ]

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

   comp.databases.paradox      To crash or not to crash, asks Borland      9,834 messages   

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

   Message 9,624 of 9,834   
   Jim Moseley to All   
   Re: Trapping for non "number"   
   26 Feb 09 11:02:40   
   
   From: jmose@mapson.attglobal.net   
      
   Craig,   
      
   >I have a field in a table which is set as a number field.   
      
   Assuming you mean that you have a form with the field, then you can check   
   what is entered by the field's keyChar() method.  For example (untested of   
   course):   
      
     method keyChar(var eventInfo KeyEvent)   
        curChar = eventInfo.char()   
        if curChar >= "0" and curChar <= "9" then   
        else   
           ; check for multiple '.'   
           if curChar = ".' then   
              oldVal = self.value   
              if oldVal.search(".") > 0 then   
                 disableDefault   
                 eventInfo.setErrorCode(canNotDepart)   
                 msgStop("Error","Only one decimal allowed")   
                 return   
              endif   
           else   
              disableDefault   
              eventInfo.setErrorCode(canNotDepart)   
              msgStop("Error","Invalid digit")   
              return   
           endif   
        endif   
        doDefault   
     endMethod   
      
   --- 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