Should be a really easy if statement

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • =?Utf-8?B?Sm9uYXRoYW4gQnJvd24=?=

    Should be a really easy if statement

    I need to evaluate the context of a textbox to see if it already contains a
    period. if it does then exit sub, else do this code.

    If me.txtbox.text contains a period then
    exit sub
    else
    code...
    end if

    Is there some sort of function for this? Something like a
    contains(me.txt box.text,".")

    I hope this makes sense.
  • =?Utf-8?B?Sm9uYXRoYW4gQnJvd24=?=

    #2
    RE: Should be a really easy if statement

    Correction. evaluate the CONTENTS of a textbox, not context.

    "Jonathan Brown" wrote:
    I need to evaluate the context of a textbox to see if it already contains a
    period. if it does then exit sub, else do this code.
    >
    If me.txtbox.text contains a period then
    exit sub
    else
    code...
    end if
    >
    Is there some sort of function for this? Something like a
    contains(me.txt box.text,".")
    >
    I hope this makes sense.

    Comment

    • kimiraikkonen

      #3
      Re: Should be a really easy if statement

      On Mar 8, 10:56 pm, Jonathan Brown
      <JonathanBr...@ discussions.mic rosoft.comwrote :
      Correction.  evaluate the CONTENTS of a textbox, not context.
      >
      >
      >
      "Jonathan Brown" wrote:
      I need to evaluate the context of a textbox to see if it already contains a
      period.  if it does then exit sub, else do this code.
      >
      If me.txtbox.text contains a period then
         exit sub
      else
         code...
      end if
      >
      Is there some sort of function for this?  Something like a
      contains(me.txt box.text,".")
      >
      I hope this makes sense.- Hide quoted text -
      >
      - Show quoted text -
      Do you mean:

      Public YourSub (....)

      If me.txtbox.text. contains("whats oever") = True Then

      Exit Sub

      Else

      ' ...Code

      End if

      End Sub

      Comment

      • kimiraikkonen

        #4
        Re: Should be a really easy if statement

        On Mar 8, 11:07 pm, kimiraikkonen <kimiraikkone.. .@gmail.comwrot e:
        On Mar 8, 10:56 pm, Jonathan Brown
        >
        >
        >
        >
        >
        <JonathanBr...@ discussions.mic rosoft.comwrote :
        Correction.  evaluate the CONTENTS of a textbox, not context.
        >
        "Jonathan Brown" wrote:
        I need to evaluate the context of a textbox to see if it already contains a
        period.  if it does then exit sub, else do this code.
        >
        If me.txtbox.text contains a period then
           exit sub
        else
           code...
        end if
        >
        Is there some sort of function for this?  Something like a
        contains(me.txt box.text,".")
        >
        I hope this makes sense.- Hide quoted text -
        >
        - Show quoted text -
        >
        Do you mean:
        Sorry, correcting:
        Public YourSub (....)
        Must be:
        Public Sub YourSub(...)

        ' ...

        ' The rest is same (below).
        If me.txtbox.text. contains("whats oever") = True Then
        >
          Exit Sub
        >
        Else
        >
        ' ...Code
        >
        End if
        >
        End Sub- Hide quoted text -
        >
        - Show quoted text -


        Comment

        • =?Utf-8?B?Sm9uYXRoYW4gQnJvd24=?=

          #5
          Re: Should be a really easy if statement

          perfect!!! thank you. That's exactly what I needed. I knew it was something
          simple.

          "kimiraikko nen" wrote:
          On Mar 8, 11:07 pm, kimiraikkonen <kimiraikkone.. .@gmail.comwrot e:
          On Mar 8, 10:56 pm, Jonathan Brown





          <JonathanBr...@ discussions.mic rosoft.comwrote :
          Correction. evaluate the CONTENTS of a textbox, not context.
          "Jonathan Brown" wrote:
          I need to evaluate the context of a textbox to see if it already contains a
          period. if it does then exit sub, else do this code.
          If me.txtbox.text contains a period then
          exit sub
          else
          code...
          end if
          Is there some sort of function for this? Something like a
          contains(me.txt box.text,".")
          I hope this makes sense.- Hide quoted text -
          - Show quoted text -
          Do you mean:
          >
          Sorry, correcting:
          >
          Public YourSub (....)
          >
          Must be:
          Public Sub YourSub(...)
          >
          ' ...
          >
          ' The rest is same (below).
          >
          If me.txtbox.text. contains("whats oever") = True Then

          Exit Sub

          Else

          ' ...Code

          End if

          End Sub- Hide quoted text -

          - Show quoted text -
          >
          >
          >
          >

          Comment

          • Cor Ligthert[MVP]

            #6
            Re: Should be a really easy if statement

            Jonathan,

            AFAIK is mostly this used to see if something exist in a string

            if MyString.IndexO f(0,".") = -1 then 'there is no dot.
            (you can concatinate that and find as well the second dot.

            Cor


            "Jonathan Brown" <JonathanBrown@ discussions.mic rosoft.comschre ef in
            bericht news:4B5C0362-D234-466E-AB1A-2E3D9FE2AFBF@mi crosoft.com...
            >I need to evaluate the context of a textbox to see if it already contains a
            period. if it does then exit sub, else do this code.
            >
            If me.txtbox.text contains a period then
            exit sub
            else
            code...
            end if
            >
            Is there some sort of function for this? Something like a
            contains(me.txt box.text,".")
            >
            I hope this makes sense.

            Comment

            • =?Utf-8?B?U3VydHVyWg==?=

              #7
              RE: Should be a really easy if statement

              I'm going to suggest INSTR, merely because it is actually BASIC.

              --
              David Streeter
              Synchrotech Software
              Sydney Australia


              "Jonathan Brown" wrote:
              I need to evaluate the context of a textbox to see if it already contains a
              period. if it does then exit sub, else do this code.
              >
              If me.txtbox.text contains a period then
              exit sub
              else
              code...
              end if
              >
              Is there some sort of function for this? Something like a
              contains(me.txt box.text,".")
              >
              I hope this makes sense.

              Comment

              Working...