How to fix this String to Long Error??

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Ron

    #1

    How to fix this String to Long Error??

    I am getting an error Option strict on disallows implicit conversion
    from string to long

    I get it for this code

    iStartPosition = InStr(iStartPos ition + 1, RichTextBox1.Te xt, "A" Or
    "a"

    the "A" and "a" are underlined in blue. How can I fix this?

    Say I want it to be:
    iStartPosition = InStr(iStartPos ition + 1, RichTextBox1.Te xt, "A" Or
    "a" Or "U" or "u" etc

    how can I make this work?

  • =?ISO-8859-1?Q?G=F6ran_Andersson?=

    #2
    Re: How to fix this String to Long Error??

    Ron wrote:
    I am getting an error Option strict on disallows implicit conversion
    from string to long
    >
    I get it for this code
    >
    iStartPosition = InStr(iStartPos ition + 1, RichTextBox1.Te xt, "A" Or
    "a"
    >
    the "A" and "a" are underlined in blue. How can I fix this?
    >
    Say I want it to be:
    iStartPosition = InStr(iStartPos ition + 1, RichTextBox1.Te xt, "A" Or
    "a" Or "U" or "u" etc
    >
    how can I make this work?
    >
    You get that error message because you are using the Or operator on two
    strings. As the operator is not defined for strings, it tries to find
    the closest match for the data types. The closest match is long, but
    there is no automatic conversion from string to long.

    You can use the IndexOfAny method to find one of many characters:

    startPosition = RichTextBox1.Te xt.IndexOfAny(N ew Char() {"A"c, "a"c,
    "U"c, "u"c})

    --
    Göran Andersson
    _____
    Göran Anderssons privata hemsida.

    Comment

    • ShaneO

      #3
      Re: How to fix this String to Long Error??

      Ron wrote:
      I am getting an error Option strict on disallows implicit conversion
      from string to long
      >
      I get it for this code
      >
      iStartPosition = InStr(iStartPos ition + 1, RichTextBox1.Te xt, "A" Or
      "a"
      >
      the "A" and "a" are underlined in blue. How can I fix this?
      >
      Say I want it to be:
      iStartPosition = InStr(iStartPos ition + 1, RichTextBox1.Te xt, "A" Or
      "a" Or "U" or "u" etc
      >
      how can I make this work?
      >
      Hello Ron, I thought you would have posted back into the original
      thread(??), but anyway, to achieve what you're asking just change the
      line to the following -

      iStartPosition = InStr(iStartPos ition + 1, RichTextBox1.Te xt, "AU-",
      CompareMethod.T ext)

      Note, all I've added is the "CompareMethod. Text"


      ShaneO

      There are 10 kinds of people - Those who understand Binary and those who
      don't.

      Comment

      • ShaneO

        #4
        Re: How to fix this String to Long Error??

        Göran Andersson wrote:
        >
        You can use the IndexOfAny method to find one of many characters:
        >
        startPosition = RichTextBox1.Te xt.IndexOfAny(N ew Char() {"A"c, "a"c,
        "U"c, "u"c})
        >
        Göran, Ron is getting a bit confused here. He is actually trying to
        find all occurrences of "AU-", "au-", "Au-" or "aU-". If he finds any
        A's or U's he'll also find A's & U's in other areas of his text, which
        isn't what he originally claimed he wanted.

        Please see his original post - "How would I do this??"


        ShaneO

        There are 10 kinds of people - Those who understand Binary and those who
        don't.

        Comment

        • Ron

          #5
          Re: How to fix this String to Long Error??

          Yes I guess I should have posted a bit more of my data file because
          there are records with aU au AU Au so I need to find variations. some
          do not have the dash because people make mistakes.

          So I can get a better idea lets say for example I want to find more
          than one letter both upper and lower of that letter.....lets say find
          Vowels Aa, Ee, Ii, Oo, Uu in that text file, then I can change them
          to fit my needs.

          How would I go about rewriting the ptrogram to go through and find
          vowels no matter where they are part number or not and then they would
          count them highlight them green etc.... this way I can then modify to
          find the combinations I need. This will give me an idea of how to
          find differant combinations.

          thanks for all your help with this, but I have not done any string
          searching or manipulation and counting of those characters so I have
          no idea what I am doing.

          On Mar 20, 1:24 am, ShaneO <spc...@optusne t.com.auwrote:
          Göran Andersson wrote:
          >
          You can use the IndexOfAny method to find one of many characters:
          >
          startPosition = RichTextBox1.Te xt.IndexOfAny(N ew Char() {"A"c, "a"c,
          "U"c, "u"c})
          >
          Göran, Ron is getting a bit confused here. He is actually trying to
          find all occurrences of "AU-", "au-", "Au-" or "aU-". If he finds any
          A's or U's he'll also find A's & U's in other areas of his text, which
          isn't what he originally claimed he wanted.
          >
          Please see his original post - "How would I do this??"
          >
          ShaneO
          >
          There are 10 kinds of people - Those who understand Binary and those who
          don't.

          Comment

          • ShaneO

            #6
            Re: How to fix this String to Long Error??

            Ron wrote:
            Yes I guess I should have posted a bit more of my data file because
            there are records with aU au AU Au so I need to find variations. some
            do not have the dash because people make mistakes.
            >
            So I can get a better idea lets say for example I want to find more
            than one letter both upper and lower of that letter.....lets say find
            Vowels Aa, Ee, Ii, Oo, Uu in that text file, then I can change them
            to fit my needs.
            >
            How would I go about rewriting the ptrogram to go through and find
            vowels no matter where they are part number or not and then they would
            count them highlight them green etc.... this way I can then modify to
            find the combinations I need. This will give me an idea of how to
            find differant combinations.
            >
            OK, looks like you're moving right away from what you originally asked
            for. Right now I would forget about letters (Vowels or otherwise) and
            take a completely different approach.

            From what you posted in your other thread, it looks like the unique
            character is in fact the hyphen ("-"). I can only go by what you
            posted, and if it is correct, then we simply need to look for that.

            The modified code for the Loop is therefore -

            Do
            iStartPosition = InStr(iStartPos ition + 1, RichTextBox1.Te xt, "-")
            If iStartPosition 0 Then
            iEndPosition = InStr(iStartPos ition, RichTextBox1.Te xt, " ")
            RichTextBox1.Se lect(iStartPosi tion - 3, (iEndPosition -
            iStartPosition) + 2)
            iStartPosition = iEndPosition
            RichTextBox1.Se lectionColor = Color.Green
            iPartNumberCoun ter += 1
            End If
            Loop Until iStartPosition = 0
            MsgBox(String.F ormat("Number of Product Codes = {0}", iPartNumberCoun ter))


            This relies on the fact that you've only ever shown or mentioned two
            characters preceding the hyphen. If this is not the case then please
            post a thorough sample of the Text File, containing a good example of
            the variations, so everyone can have a better idea of exactly what
            you're trying to read.


            ShaneO

            There are 10 kinds of people - Those who understand Binary and those who
            don't.

            Comment

            • C-Services Holland b.v.

              #7
              Re: How to fix this String to Long Error??

              Ron schreef:
              I am getting an error Option strict on disallows implicit conversion
              from string to long
              >
              I get it for this code
              >
              iStartPosition = InStr(iStartPos ition + 1, RichTextBox1.Te xt, "A" Or
              "a"
              >
              the "A" and "a" are underlined in blue. How can I fix this?
              >
              Say I want it to be:
              iStartPosition = InStr(iStartPos ition + 1, RichTextBox1.Te xt, "A" Or
              "a" Or "U" or "u" etc
              >
              how can I make this work?
              >
              If I understand it correctly, why not just this: Look for "AU" (you are
              looking for any variation of "AU") in the uppercased string of the textbox

              iStartPosition = RichTextBox1.Te xt.ToUpper.Inde xOf("AU",iStart position+1)


              --
              Rinze van Huizen
              C-Services Holland b.v

              Comment

              • Ron

                #8
                Re: How to fix this String to Long Error??

                Yes I think that in fact the unique identifier is AU, because
                sometimes the data entry folks do not enter the - by mistake.

                However I woyuld like to know how to test for and find other
                variations because I have other parts that have starting characters of
                AO, XW, and others...for example in another file there are parts that
                have a part number of E7 or e7 so would like to know how to search
                for multiple instances of differant characters.

                Can anyone help me out with that? Hopefully I am being a bit more
                specific now, sorry for all the confusion.
                so basically i just want to be able to read a file and find and
                highlight and count instances of specific letters.

                On Mar 20, 8:51 am, "C-Services Holland b.v."
                <cshNOSPAMPLE.. .@csh4u.nlwrote :
                Ron schreef:
                >
                >
                >
                >
                >
                I am getting an error Option strict on disallows implicit conversion
                from string to long
                >
                I get it for this code
                >
                iStartPosition = InStr(iStartPos ition + 1, RichTextBox1.Te xt, "A" Or
                "a"
                >
                the "A" and "a" are underlined in blue. How can I fix this?
                >
                Say I want it to be:
                iStartPosition = InStr(iStartPos ition + 1, RichTextBox1.Te xt, "A" Or
                "a" Or "U" or "u" etc
                >
                how can I make this work?
                >
                If I understand it correctly, why not just this: Look for "AU" (you are
                looking for any variation of "AU") in the uppercased string of the textbox
                >
                iStartPosition = RichTextBox1.Te xt.ToUpper.Inde xOf("AU",iStart position+1)
                >
                --
                Rinze van Huizen
                C-Services Holland b.v- Hide quoted text -
                >
                - Show quoted text -

                Comment

                • ShaneO

                  #9
                  Re: How to fix this String to Long Error??

                  Ron wrote:
                  Yes I think that in fact the unique identifier is AU, because
                  sometimes the data entry folks do not enter the - by mistake.
                  >
                  However I woyuld like to know how to test for and find other
                  variations because I have other parts that have starting characters of
                  AO, XW, and others...for example in another file there are parts that
                  have a part number of E7 or e7 so would like to know how to search
                  for multiple instances of differant characters.
                  >
                  Can anyone help me out with that? Hopefully I am being a bit more
                  specific now, sorry for all the confusion.
                  so basically i just want to be able to read a file and find and
                  highlight and count instances of specific letters.
                  >
                  Ron, if you're only looking for AU/Au/aU/au or other letter
                  combinations, then the code I provided that contains the
                  "CompareMethod. Text" will do exactly what you want, just remove the "-".

                  Your problem is going to be that some of your two letter combinations
                  are not going to be unique and will appear within other words, not just
                  Part Numbers. You will still need to find something that makes your
                  Part Numbers unique.

                  The offer is still there, if you would like to post a broader example of
                  your Text File then maybe we can help you discover the unique
                  combination that will provide you a solution.


                  ShaneO

                  There are 10 kinds of people - Those who understand Binary and those who
                  don't.

                  Comment

                  • Ron

                    #10
                    Re: How to fix this String to Long Error??

                    thanks for all of the help. I modified your code to find vowels but
                    in my Part number and desctription file. I did this because I want to
                    get an idea how this works and how to get it to work.

                    here is what I did:

                    Private Sub btnprocess_Clic k(ByVal sender As System.Object, ByVal e As
                    System.EventArg s) Handles btnprocess.Clic k
                    RichTextBox1.Te xt = My.Computer.Fil eSystem.ReadAll Text("c:
                    \testfile.txt")
                    Dim iStartPosition, iEndPosition, iVowel As Integer


                    Do
                    iStartPosition = InStr(CStr(iSta rtPosition + 1),
                    CStr(RichTextBo x1.Text.IndexOf Any(New Char() {"A"c, "a"c, "E"c, "e"c,
                    "I"c, "i"c, "O"c, "o"c, "U"c, "u"c})))


                    If iStartPosition 0 Then
                    iEndPosition = InStr(iStartPos ition,
                    RichTextBox1.Te xt, " ")
                    RichTextBox1.Se lect(iStartPosi tion - 1, iEndPosition -
                    iStartPosition)
                    iStartPosition = iEndPosition
                    RichTextBox1.Se lectionColor = Color.Green
                    iVowel += 1
                    End If
                    Loop Until iStartPosition = 0
                    MsgBox(String.F ormat("Number of vowels = {0}", iVowel))


                    my text file that looks like this:
                    Part number descriptions sorted by type and time built
                    =============== =============== ==========
                    AU-22453 Thermal paster AU-22468 Thermal paster control AU-22490
                    Thermal trial packs AU-22628 Control unit plates AU-22615 Paste dust
                    AU-226221503 NOX Connector

                    The textfile is displayed in the textbox but the whole first word is
                    highlighted in Green and none of the other vowels. And the textbox
                    says only one vowel has been found.

                    Can you help me fix this? I thought this would have helped me look
                    for numerous characters, for instance in this case I want to find
                    vowels.


                    On Mar 20, 4:50 pm, ShaneO <spc...@optusne t.com.auwrote:
                    Ron wrote:
                    Yes I think that in fact the unique identifier is AU, because
                    sometimes the data entry folks do not enter the - by mistake.
                    >
                    However I woyuld like to know how to test for and find other
                    variations because I have other parts that have starting characters of
                    AO, XW, and others...for example in another file there are parts that
                    have a part number of E7 or e7 so would like to know how to search
                    for multiple instances of differant characters.
                    >
                    Can anyone help me out with that? Hopefully I am being a bit more
                    specific now, sorry for all the confusion.
                    so basically i just want to be able to read a file and find and
                    highlight and count instances of specific letters.
                    >
                    Ron, if you're only looking for AU/Au/aU/au or other letter
                    combinations, then the code I provided that contains the
                    "CompareMethod. Text" will do exactly what you want, just remove the "-".
                    >
                    Your problem is going to be that some of your two letter combinations
                    are not going to be unique and will appear within other words, not just
                    Part Numbers. You will still need to find something that makes your
                    Part Numbers unique.
                    >
                    The offer is still there, if you would like to post a broader example of
                    your Text File then maybe we can help you discover the unique
                    combination that will provide you a solution.
                    >
                    ShaneO
                    >
                    There are 10 kinds of people - Those who understand Binary and those who
                    don't.

                    Comment

                    • =?ISO-8859-1?Q?G=F6ran_Andersson?=

                      #11
                      Re: How to fix this String to Long Error??

                      Ron wrote:
                      thanks for all of the help. I modified your code to find vowels but
                      in my Part number and desctription file. I did this because I want to
                      get an idea how this works and how to get it to work.
                      >
                      here is what I did:
                      >
                      Private Sub btnprocess_Clic k(ByVal sender As System.Object, ByVal e As
                      System.EventArg s) Handles btnprocess.Clic k
                      RichTextBox1.Te xt = My.Computer.Fil eSystem.ReadAll Text("c:
                      \testfile.txt")
                      Dim iStartPosition, iEndPosition, iVowel As Integer
                      >
                      >
                      Do
                      iStartPosition = InStr(CStr(iSta rtPosition + 1),
                      CStr(RichTextBo x1.Text.IndexOf Any(New Char() {"A"c, "a"c, "E"c, "e"c,
                      "I"c, "i"c, "O"c, "o"c, "U"c, "u"c})))
                      You are mixing up the codes completely. You should use the IndexOfAny
                      method _instead_ of the InStr function. Now you are making a string
                      search for the string representation of a number inside the string
                      representation of the result of a string search.

                      iStartPosition = RichTextBox1.Te xt.IndexOfAny(N ew Char() {"A"c, "a"c,
                      "E"c, "e"c, "I"c, "i"c, "O"c, "o"c, "U"c, "u"c}), iStartPosition)
                      >
                      If iStartPosition 0 Then
                      If iStartPosition <-1 Then
                      iEndPosition = InStr(iStartPos ition,
                      RichTextBox1.Te xt, " ")
                      iEndPosition = RichTextBox1.Te xt.IndexOf(" "c, iStartPosition)
                      RichTextBox1.Se lect(iStartPosi tion - 1, iEndPosition -
                      iStartPosition)
                      RichTextBox1.Se lect(iStartPosi tion, iEndPosition - iStartPosition)
                      iStartPosition = iEndPosition
                      RichTextBox1.Se lectionColor = Color.Green
                      iVowel += 1
                      End If
                      Loop Until iStartPosition = 0
                      Loop Until iStartPosition = -1
                      MsgBox(String.F ormat("Number of vowels = {0}", iVowel))
                      >
                      >
                      my text file that looks like this:
                      Part number descriptions sorted by type and time built
                      =============== =============== ==========
                      AU-22453 Thermal paster AU-22468 Thermal paster control AU-22490
                      Thermal trial packs AU-22628 Control unit plates AU-22615 Paste dust
                      AU-226221503 NOX Connector
                      >
                      The textfile is displayed in the textbox but the whole first word is
                      highlighted in Green and none of the other vowels. And the textbox
                      says only one vowel has been found.
                      >
                      Can you help me fix this? I thought this would have helped me look
                      for numerous characters, for instance in this case I want to find
                      vowels.
                      >
                      >
                      On Mar 20, 4:50 pm, ShaneO <spc...@optusne t.com.auwrote:
                      >Ron wrote:
                      >>Yes I think that in fact the unique identifier is AU, because
                      >>sometimes the data entry folks do not enter the - by mistake.
                      >>However I woyuld like to know how to test for and find other
                      >>variations because I have other parts that have starting characters of
                      >>AO, XW, and others...for example in another file there are parts that
                      >>have a part number of E7 or e7 so would like to know how to search
                      >>for multiple instances of differant characters.
                      >>Can anyone help me out with that? Hopefully I am being a bit more
                      >>specific now, sorry for all the confusion.
                      >>so basically i just want to be able to read a file and find and
                      >>highlight and count instances of specific letters.
                      >Ron, if you're only looking for AU/Au/aU/au or other letter
                      >combinations , then the code I provided that contains the
                      >"CompareMethod .Text" will do exactly what you want, just remove the "-".
                      >>
                      >Your problem is going to be that some of your two letter combinations
                      >are not going to be unique and will appear within other words, not just
                      >Part Numbers. You will still need to find something that makes your
                      >Part Numbers unique.
                      >>
                      >The offer is still there, if you would like to post a broader example of
                      >your Text File then maybe we can help you discover the unique
                      >combination that will provide you a solution.
                      >>
                      >ShaneO
                      >>
                      >There are 10 kinds of people - Those who understand Binary and those who
                      >don't.
                      >
                      >

                      --
                      Göran Andersson
                      _____
                      Göran Anderssons privata hemsida.

                      Comment

                      • Ron

                        #12
                        Re: How to fix this String to Long Error??

                        well with this code all of the words in my file are highlighted in
                        green except for the last 5 letrters of the last word.

                        On Mar 21, 3:51 am, Göran Andersson <g...@guffa.com wrote:
                        Ron wrote:
                        thanks for all of the help. I modified your code to find vowels but
                        in my Part number and desctription file. I did this because I want to
                        get an idea how this works and how to get it to work.
                        >
                        here is what I did:
                        >
                        Private Sub btnprocess_Clic k(ByVal sender As System.Object, ByVal e As
                        System.EventArg s) Handles btnprocess.Clic k
                        RichTextBox1.Te xt = My.Computer.Fil eSystem.ReadAll Text("c:
                        \testfile.txt")
                        Dim iStartPosition, iEndPosition, iVowel As Integer
                        >
                        Do
                        iStartPosition = InStr(CStr(iSta rtPosition + 1),
                        CStr(RichTextBo x1.Text.IndexOf Any(New Char() {"A"c, "a"c, "E"c, "e"c,
                        "I"c, "i"c, "O"c, "o"c, "U"c, "u"c})))
                        >
                        You are mixing up the codes completely. You should use the IndexOfAny
                        method _instead_ of the InStr function. Now you are making a string
                        search for the string representation of a number inside the string
                        representation of the result of a string search.
                        >
                        iStartPosition = RichTextBox1.Te xt.IndexOfAny(N ew Char() {"A"c, "a"c,
                        "E"c, "e"c, "I"c, "i"c, "O"c, "o"c, "U"c, "u"c}), iStartPosition)
                        >
                        >
                        >
                        If iStartPosition 0 Then
                        >
                        If iStartPosition <-1 Then
                        >
                        iEndPosition = InStr(iStartPos ition,
                        RichTextBox1.Te xt, " ")
                        >
                        iEndPosition = RichTextBox1.Te xt.IndexOf(" "c, iStartPosition)
                        >
                        RichTextBox1.Se lect(iStartPosi tion - 1, iEndPosition -
                        iStartPosition)
                        >
                        RichTextBox1.Se lect(iStartPosi tion, iEndPosition - iStartPosition)
                        >
                        iStartPosition = iEndPosition
                        RichTextBox1.Se lectionColor = Color.Green
                        iVowel += 1
                        End If
                        Loop Until iStartPosition = 0
                        >
                        Loop Until iStartPosition = -1
                        >
                        >
                        >
                        >
                        >
                        MsgBox(String.F ormat("Number of vowels = {0}", iVowel))
                        >
                        my text file that looks like this:
                        Part number descriptions sorted by type and time built
                        =============== =============== ==========
                        AU-22453 Thermal paster AU-22468 Thermal paster control AU-22490
                        Thermal trial packs AU-22628 Control unit plates AU-22615 Paste dust
                        AU-226221503 NOX Connector
                        >
                        The textfile is displayed in the textbox but the whole first word is
                        highlighted in Green and none of the other vowels. And the textbox
                        says only one vowel has been found.
                        >
                        Can you help me fix this? I thought this would have helped me look
                        for numerous characters, for instance in this case I want to find
                        vowels.
                        >
                        On Mar 20, 4:50 pm, ShaneO <spc...@optusne t.com.auwrote:
                        Ron wrote:
                        >Yes I think that in fact the unique identifier is AU, because
                        >sometimes the data entry folks do not enter the - by mistake.
                        >However I woyuld like to know how to test for and find other
                        >variations because I have other parts that have starting characters of
                        >AO, XW, and others...for example in another file there are parts that
                        >have a part number of E7 or e7 so would like to know how to search
                        >for multiple instances of differant characters.
                        >Can anyone help me out with that? Hopefully I am being a bit more
                        >specific now, sorry for all the confusion.
                        >so basically i just want to be able to read a file and find and
                        >highlight and count instances of specific letters.
                        Ron, if you're only looking for AU/Au/aU/au or other letter
                        combinations, then the code I provided that contains the
                        "CompareMethod. Text" will do exactly what you want, just remove the "-".
                        >
                        Your problem is going to be that some of your two letter combinations
                        are not going to be unique and will appear within other words, not just
                        Part Numbers. You will still need to find something that makes your
                        Part Numbers unique.
                        >
                        The offer is still there, if you would like to post a broader example of
                        your Text File then maybe we can help you discover the unique
                        combination that will provide you a solution.
                        >
                        ShaneO
                        >
                        There are 10 kinds of people - Those who understand Binary and those who
                        don't.
                        >
                        --
                        Göran Andersson
                        _____http://www.guffa.com- Hide quoted text -
                        >
                        - Show quoted text -- Hide quoted text -
                        >
                        - Show quoted text -

                        Comment

                        • =?ISO-8859-1?Q?G=F6ran_Andersson?=

                          #13
                          Re: How to fix this String to Long Error??

                          That's because you are looking for a space after the part number. You
                          have to check the result in iEndPosition and use the length of the
                          string instead, if no space is found after the part number.

                          Ron wrote:
                          well with this code all of the words in my file are highlighted in
                          green except for the last 5 letrters of the last word.
                          >
                          On Mar 21, 3:51 am, Göran Andersson <g...@guffa.com wrote:
                          >Ron wrote:
                          >>thanks for all of the help. I modified your code to find vowels but
                          >>in my Part number and desctription file. I did this because I want to
                          >>get an idea how this works and how to get it to work.
                          >>here is what I did:
                          >>Private Sub btnprocess_Clic k(ByVal sender As System.Object, ByVal e As
                          >>System.EventA rgs) Handles btnprocess.Clic k
                          >> RichTextBox1.Te xt = My.Computer.Fil eSystem.ReadAll Text("c:
                          >>\testfile.txt ")
                          >> Dim iStartPosition, iEndPosition, iVowel As Integer
                          >> Do
                          >> iStartPosition = InStr(CStr(iSta rtPosition + 1),
                          >>CStr(RichText Box1.Text.Index OfAny(New Char() {"A"c, "a"c, "E"c, "e"c,
                          >>"I"c, "i"c, "O"c, "o"c, "U"c, "u"c})))
                          >You are mixing up the codes completely. You should use the IndexOfAny
                          >method _instead_ of the InStr function. Now you are making a string
                          >search for the string representation of a number inside the string
                          >representati on of the result of a string search.
                          >>
                          >iStartPositi on = RichTextBox1.Te xt.IndexOfAny(N ew Char() {"A"c, "a"c,
                          >"E"c, "e"c, "I"c, "i"c, "O"c, "o"c, "U"c, "u"c}), iStartPosition)
                          >>
                          >>
                          >>
                          >> If iStartPosition 0 Then
                          >If iStartPosition <-1 Then
                          >>
                          >> iEndPosition = InStr(iStartPos ition,
                          >>RichTextBox1. Text, " ")
                          >iEndPosition = RichTextBox1.Te xt.IndexOf(" "c, iStartPosition)
                          >>
                          >> RichTextBox1.Se lect(iStartPosi tion - 1, iEndPosition -
                          >>iStartPositio n)
                          >RichTextBox1.S elect(iStartPos ition, iEndPosition - iStartPosition)
                          >>
                          >> iStartPosition = iEndPosition
                          >> RichTextBox1.Se lectionColor = Color.Green
                          >> iVowel += 1
                          >> End If
                          >> Loop Until iStartPosition = 0
                          >Loop Until iStartPosition = -1
                          >>
                          >>
                          >>
                          >>
                          >>
                          >> MsgBox(String.F ormat("Number of vowels = {0}", iVowel))
                          >>my text file that looks like this:
                          >>Part number descriptions sorted by type and time built
                          >>============= =============== ============
                          >>AU-22453 Thermal paster AU-22468 Thermal paster control AU-22490
                          >>Thermal trial packs AU-22628 Control unit plates AU-22615 Paste dust
                          >>AU-226221503 NOX Connector
                          >>The textfile is displayed in the textbox but the whole first word is
                          >>highlighted in Green and none of the other vowels. And the textbox
                          >>says only one vowel has been found.
                          >>Can you help me fix this? I thought this would have helped me look
                          >>for numerous characters, for instance in this case I want to find
                          >>vowels.
                          >>On Mar 20, 4:50 pm, ShaneO <spc...@optusne t.com.auwrote:
                          >>>Ron wrote:
                          >>>>Yes I think that in fact the unique identifier is AU, because
                          >>>>sometimes the data entry folks do not enter the - by mistake.
                          >>>>However I woyuld like to know how to test for and find other
                          >>>>variation s because I have other parts that have starting characters of
                          >>>>AO, XW, and others...for example in another file there are parts that
                          >>>>have a part number of E7 or e7 so would like to know how to search
                          >>>>for multiple instances of differant characters.
                          >>>>Can anyone help me out with that? Hopefully I am being a bit more
                          >>>>specific now, sorry for all the confusion.
                          >>>>so basically i just want to be able to read a file and find and
                          >>>>highlight and count instances of specific letters.
                          >>>Ron, if you're only looking for AU/Au/aU/au or other letter
                          >>>combinations , then the code I provided that contains the
                          >>>"CompareMeth od.Text" will do exactly what you want, just remove the "-".
                          >>>Your problem is going to be that some of your two letter combinations
                          >>>are not going to be unique and will appear within other words, not just
                          >>>Part Numbers. You will still need to find something that makes your
                          >>>Part Numbers unique.
                          >>>The offer is still there, if you would like to post a broader example of
                          >>>your Text File then maybe we can help you discover the unique
                          >>>combinatio n that will provide you a solution.
                          >>>ShaneO
                          >>>There are 10 kinds of people - Those who understand Binary and those who
                          >>>don't.
                          >--
                          >Göran Andersson
                          >_____http://www.guffa.com- Hide quoted text -
                          >>
                          >- Show quoted text -- Hide quoted text -
                          >>
                          >- Show quoted text -
                          >
                          >

                          --
                          Göran Andersson
                          _____
                          Göran Anderssons privata hemsida.

                          Comment

                          Working...