Loading ...
Sorry, an error occurred while loading the content.

Re: Ignoring/Detecting numbers in textbox

Expand Messages
  • loudmarshall06
    Hi, Thank you for your reply - it works a treat! ... element ... then nonalphaflag=1: exit for ... gives user an error message and requests input again ...
    Message 1 of 7 , Feb 17 2:35 PM
    • 0 Attachment
      Hi,

      Thank you for your reply - it works a treat!


      --- In libertybasic@yahoogroups.com, Lorne Russell <lorneokb@...>
      wrote:
      >
      > get the contents of the textbox in a string (text$) then test each
      element
      >
      > print #main.textbox, "!contents?"
      > input #main.textbox, text$
      > nonalphaflag=0
      > for x=1 to len(text$)
      > if instr("abcdefghijklmnopqrstuvwxyz",lower$(mid$(text$,x,1)))=0
      then nonalphaflag=1: exit for
      > next x
      > if nonalphaflag=1 then branch to routine that clears the textbox,
      gives user an error message and requests input again
      >
      >
      >
      >
      > ----- Original Message -----
      > From: loudmarshall06
      > To: libertybasic@yahoogroups.com
      > Sent: Saturday, February 16, 2008 9:07 AM
      > Subject: [libertybasic] Ignoring/Detecting numbers in textbox
      >
      >
      > Dear all,
      >
      > I am writing a program in which needs the user to enter a word
      into a
      > textbox. Does anyone know how to make it either a) so that the
      user
      > cannot put numbers into the text box, or b) so that the program
      > recognises that numbers are in the textbox and gosubs to to an
      error or
      > ignore message or something.
      >
      > Cheerie bye,
      >
      > Rob
      >
      >
      >
      >
      >
      > [Non-text portions of this message have been removed]
      >
    • loudmarshall06
      Hi there, Many thanks for your response. This code almost worked, however it doesn t detect that there is a number in the textbox if the number happens to be
      Message 2 of 7 , Feb 17 2:37 PM
      • 0 Attachment
        Hi there,

        Many thanks for your response. This code almost worked, however it
        doesn't detect that there is a number in the textbox if the number
        happens to be 0.

        Thanks again,

        Rob

        --- In libertybasic@yahoogroups.com, "psycho_bullet_stopper"
        <john_siejkowski@...> wrote:
        >
        > There may be a more efficient way but the following works.
        > (get the word from your textbox rather than my input statement)
        >
        > input "Type a word ";word$
        > length = len(word$)
        > number=0
        > for x = 1 to length
        > test$=mid$(word$,x)
        > if val(test$)<>0 then number = 1
        > next x
        > if number > 0 then
        > print "You had a number in your entry."
        > else
        > print "Your word was ";word$
        > end if
        >
      • loudmarshall06
        Trying to limit user destruction of anything, not just software, is a real headache. They never use it in quite the same way the designer thought. ... art
        Message 3 of 7 , Feb 17 2:38 PM
        • 0 Attachment
          Trying to limit user destruction of anything, not just software, is a
          real headache. They never use it in 'quite' the same way the
          designer thought.

          --- In libertybasic@yahoogroups.com, "rod_bird001" <rodbird@...>
          wrote:
          >
          > Limiting user destruction of your carefully crafted program is an
          art
          > form. Do they have to be able to enter free text? can you not limit
          > them to yes no, or better still ok? If it wasn't for humans,
          computing
          > would be enjoyable. List boxes are your friend.
          >
          > --- In libertybasic@yahoogroups.com, "loudmarshall06" <forums@>
          > wrote:
          > >
          > > Dear all,
          > >
          > > I am writing a program in which needs the user to enter a word
          into a
          > > textbox. Does anyone know how to make it either a) so that the
          user
          > > cannot put numbers into the text box, or b) so that the program
          > > recognises that numbers are in the textbox and gosubs to to an
          error
          > or
          > > ignore message or something.
          > >
          > > Cheerie bye,
          > >
          > > Rob
          > >
          >
        Your message has been successfully submitted and would be delivered to recipients shortly.