String Manipulating within List

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Kin®sole

    String Manipulating within List

    Hi
    I'm very new to VB (using VB6)
    I have two lists one blank and one containing names in the format of surname
    and then forename.I also have a combo box containing forenames.When I
    select a forename from my combo box I need to add the corresponding surname
    into the blank list box.What is the best way to do this? hope this make
    sense

    TIA

    --
    cheers dude
    ************
    kin®sole
    ************





  • Larry Serflaten

    #2
    Re: String Manipulating within List


    "Kin®sole" <kinrsole@NOSPA Mhotmail.com> wrote
    [color=blue]
    > I'm very new to VB (using VB6)
    > I have two lists one blank and one containing names in the format of surname
    > and then forename.I also have a combo box containing forenames.When I
    > select a forename from my combo box I need to add the corresponding surname
    > into the blank list box.What is the best way to do this? hope this make
    > sense[/color]


    How did you build the lists? The combo and listbox both have an ItemData
    property that may be of use when you are adding names. Post a small example
    so we can see what you've got so far....

    LFS




    -----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
    http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
    -----== Over 100,000 Newsgroups - 19 Different Servers! =-----

    Comment

    • Kin®sole

      #3
      Re: String Manipulating within List

      The easiest thing is for me to give you an example.
      I have a list box (lstfullnames) a combo box (cmbforenames) and an empty
      list box (lstsurnames)

      In lstfullnames is the name Smith Bob. In cmbforenames is the name Bob. When
      I click on Bob in the combo box in need to see if the name is in the
      lstfullnames list and if it is then enter the surname (Smith) into the
      lstsurname list box.

      "Larry Serflaten" <Abuse@SpamBust ers.com> wrote in message
      news:405cde15$1 _8@corp.newsgro ups.com...[color=blue]
      >
      > "Kin®sole" <kinrsole@NOSPA Mhotmail.com> wrote
      >[color=green]
      > > I'm very new to VB (using VB6)
      > > I have two lists one blank and one containing names in the format of[/color][/color]
      surname[color=blue][color=green]
      > > and then forename.I also have a combo box containing forenames.When I
      > > select a forename from my combo box I need to add the corresponding[/color][/color]
      surname[color=blue][color=green]
      > > into the blank list box.What is the best way to do this? hope this make
      > > sense[/color]
      >
      >
      > How did you build the lists? The combo and listbox both have an ItemData
      > property that may be of use when you are adding names. Post a small[/color]
      example[color=blue]
      > so we can see what you've got so far....
      >
      > LFS
      >
      >
      >
      >
      > -----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
      > http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
      > -----== Over 100,000 Newsgroups - 19 Different Servers! =-----[/color]


      Comment

      • Randy Birch

        #4
        Re: String Manipulating within List

        You're missing the point. You will learn more if you show us what you've
        attempted so we can comment and straighten you out in your handling of the
        code. Just handing you an answer won't teach you anything. We understand
        what you want, now let's see the source you've tried in order to achieve the
        result.

        --

        Randy Birch
        MVP Visual Basic

        Please respond only to the newsgroups so all can benefit.


        "Kin®sole" <kinrsole@NOSPA Mhotmail.com> wrote in message
        news:b2e64225a4 f41caa528593d62 ef25b9a@news.te ranews.com...
        : The easiest thing is for me to give you an example.
        : I have a list box (lstfullnames) a combo box (cmbforenames) and an empty
        : list box (lstsurnames)
        :
        : In lstfullnames is the name Smith Bob. In cmbforenames is the name Bob.
        When
        : I click on Bob in the combo box in need to see if the name is in the
        : lstfullnames list and if it is then enter the surname (Smith) into the
        : lstsurname list box.
        :
        : "Larry Serflaten" <Abuse@SpamBust ers.com> wrote in message
        : news:405cde15$1 _8@corp.newsgro ups.com...
        : >
        : > "Kin®sole" <kinrsole@NOSPA Mhotmail.com> wrote
        : >
        : > > I'm very new to VB (using VB6)
        : > > I have two lists one blank and one containing names in the format of
        : surname
        : > > and then forename.I also have a combo box containing forenames.When I
        : > > select a forename from my combo box I need to add the corresponding
        : surname
        : > > into the blank list box.What is the best way to do this? hope this
        make
        : > > sense
        : >
        : >
        : > How did you build the lists? The combo and listbox both have an
        ItemData
        : > property that may be of use when you are adding names. Post a small
        : example
        : > so we can see what you've got so far....
        : >
        : > LFS
        : >
        : >
        : >
        : >
        : > -----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
        : > http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
        : > -----== Over 100,000 Newsgroups - 19 Different Servers! =-----
        :
        :


        Comment

        • Kin®sole

          #5
          Re: String Manipulating within List

          OK here's my code so far.This works if I have both surname and forename in
          the forename combo box.I don't know how to Manipulate the full name in the
          list to allow me to match just the first name.
          Thanks for any help.


          Option Explicit

          Private Sub cmbForenames_Cl ick()
          Dim namestr, namestr1, namestr2, namestr3, output, value As String
          Dim num, number, count As Integer
          Dim flag As Boolean

          Let number = lstFullNames.Li stCount
          Let num = cmbForenames.Li stIndex
          Let namestr = cmbForenames.Li st(num)

          Let namestr = LTrim$(namestr)

          Let namestr = RTrim$(namestr)

          Let namestr = UCase(Left$(nam estr, 1)) + Right$(namestr, Len(namestr) -
          1)

          For count = 0 To number

          If lstFullNames.Li st(count) = namestr Then
          flag = True

          End If

          Next count
          If flag = False Then
          MsgBox ("name is not in the list")
          Else
          Let namestr2 = Len(namestr)
          Let namestr1 = InStr(1, namestr, " ")
          Let namestr3 = Left$(namestr, namestr1)
          lstsurnames.Add Item (namestr3)

          End If

          End Sub

          Private Sub cmdExit_Click()
          Unload Me
          End Sub

          "Randy Birch" <rgb_removethis @mvps.org> wrote in message
          news:edi7c.1069 73$uUx1.78426@t wister01.bloor. is.net.cable.ro gers.com...[color=blue]
          > You're missing the point. You will learn more if you show us what you've
          > attempted so we can comment and straighten you out in your handling of the
          > code. Just handing you an answer won't teach you anything. We understand
          > what you want, now let's see the source you've tried in order to achieve[/color]
          the[color=blue]
          > result.
          >
          > --
          >
          > Randy Birch
          > MVP Visual Basic
          > http://vbnet.mvps.org/
          > Please respond only to the newsgroups so all can benefit.
          >
          >
          > "Kin®sole" <kinrsole@NOSPA Mhotmail.com> wrote in message
          > news:b2e64225a4 f41caa528593d62 ef25b9a@news.te ranews.com...
          > : The easiest thing is for me to give you an example.
          > : I have a list box (lstfullnames) a combo box (cmbforenames) and an empty
          > : list box (lstsurnames)
          > :
          > : In lstfullnames is the name Smith Bob. In cmbforenames is the name Bob.
          > When
          > : I click on Bob in the combo box in need to see if the name is in the
          > : lstfullnames list and if it is then enter the surname (Smith) into the
          > : lstsurname list box.
          > :
          > : "Larry Serflaten" <Abuse@SpamBust ers.com> wrote in message
          > : news:405cde15$1 _8@corp.newsgro ups.com...
          > : >
          > : > "Kin®sole" <kinrsole@NOSPA Mhotmail.com> wrote
          > : >
          > : > > I'm very new to VB (using VB6)
          > : > > I have two lists one blank and one containing names in the format of
          > : surname
          > : > > and then forename.I also have a combo box containing forenames.When[/color]
          I[color=blue]
          > : > > select a forename from my combo box I need to add the corresponding
          > : surname
          > : > > into the blank list box.What is the best way to do this? hope this
          > make
          > : > > sense
          > : >
          > : >
          > : > How did you build the lists? The combo and listbox both have an
          > ItemData
          > : > property that may be of use when you are adding names. Post a small
          > : example
          > : > so we can see what you've got so far....
          > : >
          > : > LFS
          > : >
          > : >
          > : >
          > : >
          > : > -----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
          > : > http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
          > : > -----== Over 100,000 Newsgroups - 19 Different Servers! =-----
          > :
          > :
          >
          >[/color]


          Comment

          • Larry Serflaten

            #6
            Re: String Manipulating within List


            "Kin®sole" <kinrsole@NOSPA Mhotmail.com> wrote[color=blue]
            > OK here's my code so far.This works if I have both surname and forename in
            > the forename combo box.I don't know how to Manipulate the full name in the
            > list to allow me to match just the first name.[/color]

            I already asked, how are you building the lists? What you posted did not
            show any names....

            REF:
            [color=blue][color=green]
            > > : "Larry Serflaten" wrote
            > > : >
            > > : > How did you build the lists? The combo and listbox both have an ItemData
            > > : > property that may be of use when you are adding names. Post a small example
            > > : > so we can see what you've got so far....[/color][/color]






            -----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
            http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
            -----== Over 100,000 Newsgroups - 19 Different Servers! =-----

            Comment

            • Rick Rothstein

              #7
              Re: String Manipulating within List

              > Dim namestr, namestr1, namestr2, namestr3, output, value As String[color=blue]
              > Dim num, number, count As Integer[/color]

              For the above two lines from your posted code, only 'value' is a String and
              'count' an Integer... all other variables are declared as Variants. In VB,
              you must specify the type of **each** variable individually.

              [color=blue]
              > Let number = lstFullNames.Li stCount
              > Let num = cmbForenames.Li stIndex
              > Let namestr = cmbForenames.Li st(num)
              > <<<etc>>>[/color]

              VB does not require the use of the Let keyword to assign values to variables
              or arrays. You can save yourself some typing by leaving it out.


              Rick - MVP


              Comment

              • Larry Serflaten

                #8
                Re: String Manipulating within List


                "Kin®sole" <kinrsole@NOSPA Mhotmail.com> wrote[color=blue]
                > OK here's my code so far.[/color]

                Just for your future reference:

                When you are looking for help with a problem, it often is beneficial
                to work up a small demo to reproduce the problem so that others
                can copy and paste the code into VB, to see it on their system.

                Some questions don't need a code example (Like; Where is the Help file?)
                but those that are syntax or logic related often do need a example.
                Also, it often happens, that in the process of building a smaller demo
                of the problem, that the answer becomes apparent, and the problem is
                solved before it is even posted. It is a learning experience to break
                some problem down to just the bare necessities, and if you can't solve
                it then, you'll have a small demo to post for others to help find the
                answer. Thats why I ask for example code, it is far easier for you to
                show me the problem, than for me to guess at what you're doing,
                and sometimes the answer becomes apparent just by building the demo.

                Of course, another reason is because myself and other regular posters
                are also on the look out for students trying to get someone to do their
                homework! ;-) If the student shows their work, adding a tweek here
                or there is generally enough to get through the 'problem'.

                LFS






                -----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
                http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
                -----== Over 100,000 Newsgroups - 19 Different Servers! =-----

                Comment

                • Kin®sole

                  #9
                  Re: String Manipulating within List

                  As I say I an very new to VB.
                  The lists are just constructed at design time.
                  It is my collage homework but I have reached a point where I am stuck.I can
                  not figure out how to search for part of a string i.e forename within a
                  list.I know I need to some how remove the surname form the fullname list but
                  don't know how.
                  I thing I need to use ' INSTR' to find the space then use RIGHT$ to remove
                  the surname but I can get this to work for each entry in the list.
                  I'm only looking for a pointer!

                  cheers

                  "Larry Serflaten" <Abuse@SpamBust ers.com> wrote in message
                  news:405ddde4_8 @corp.newsgroup s.com...[color=blue]
                  >
                  > "Kin®sole" <kinrsole@NOSPA Mhotmail.com> wrote[color=green]
                  > > OK here's my code so far.[/color]
                  >
                  > Just for your future reference:
                  >
                  > When you are looking for help with a problem, it often is beneficial
                  > to work up a small demo to reproduce the problem so that others
                  > can copy and paste the code into VB, to see it on their system.
                  >
                  > Some questions don't need a code example (Like; Where is the Help file?)
                  > but those that are syntax or logic related often do need a example.
                  > Also, it often happens, that in the process of building a smaller demo
                  > of the problem, that the answer becomes apparent, and the problem is
                  > solved before it is even posted. It is a learning experience to break
                  > some problem down to just the bare necessities, and if you can't solve
                  > it then, you'll have a small demo to post for others to help find the
                  > answer. Thats why I ask for example code, it is far easier for you to
                  > show me the problem, than for me to guess at what you're doing,
                  > and sometimes the answer becomes apparent just by building the demo.
                  >
                  > Of course, another reason is because myself and other regular posters
                  > are also on the look out for students trying to get someone to do their
                  > homework! ;-) If the student shows their work, adding a tweek here
                  > or there is generally enough to get through the 'problem'.
                  >
                  > LFS
                  >
                  >
                  >
                  >
                  >
                  >
                  > -----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
                  > http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
                  > -----== Over 100,000 Newsgroups - 19 Different Servers! =-----[/color]


                  Comment

                  • Kin®sole

                    #10
                    Re: String Manipulating within List

                    sorry that should read " but I can get this to work for each entry in the
                    list."

                    cheers
                    "Kin®sole" <kinrsole@NOSPA Mhotmail.com> wrote in message
                    news:0a5fcb02f5 0ed362b08064cd1 6b7f231@news.te ranews.com...[color=blue]
                    > As I say I an very new to VB.
                    > The lists are just constructed at design time.
                    > It is my collage homework but I have reached a point where I am stuck.I[/color]
                    can[color=blue]
                    > not figure out how to search for part of a string i.e forename within a
                    > list.I know I need to some how remove the surname form the fullname list[/color]
                    but[color=blue]
                    > don't know how.
                    > I thing I need to use ' INSTR' to find the space then use RIGHT$ to remove
                    > the surname but I can get this to work for each entry in the list.
                    > I'm only looking for a pointer!
                    >
                    > cheers
                    >
                    > "Larry Serflaten" <Abuse@SpamBust ers.com> wrote in message
                    > news:405ddde4_8 @corp.newsgroup s.com...[color=green]
                    > >
                    > > "Kin®sole" <kinrsole@NOSPA Mhotmail.com> wrote[color=darkred]
                    > > > OK here's my code so far.[/color]
                    > >
                    > > Just for your future reference:
                    > >
                    > > When you are looking for help with a problem, it often is beneficial
                    > > to work up a small demo to reproduce the problem so that others
                    > > can copy and paste the code into VB, to see it on their system.
                    > >
                    > > Some questions don't need a code example (Like; Where is the Help file?)
                    > > but those that are syntax or logic related often do need a example.
                    > > Also, it often happens, that in the process of building a smaller demo
                    > > of the problem, that the answer becomes apparent, and the problem is
                    > > solved before it is even posted. It is a learning experience to break
                    > > some problem down to just the bare necessities, and if you can't solve
                    > > it then, you'll have a small demo to post for others to help find the
                    > > answer. Thats why I ask for example code, it is far easier for you to
                    > > show me the problem, than for me to guess at what you're doing,
                    > > and sometimes the answer becomes apparent just by building the demo.
                    > >
                    > > Of course, another reason is because myself and other regular posters
                    > > are also on the look out for students trying to get someone to do their
                    > > homework! ;-) If the student shows their work, adding a tweek here
                    > > or there is generally enough to get through the 'problem'.
                    > >
                    > > LFS
                    > >
                    > >
                    > >
                    > >
                    > >
                    > >
                    > > -----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
                    > > http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
                    > > -----== Over 100,000 Newsgroups - 19 Different Servers! =-----[/color]
                    >
                    >[/color]


                    Comment

                    • Rick Rothstein

                      #11
                      Re: String Manipulating within List

                      > I have two lists one blank and one containing names in the format of
                      surname[color=blue]
                      > and then forename.I also have a combo box containing forenames.When I
                      > select a forename from my combo box I need to add the corresponding[/color]
                      surname[color=blue]
                      > into the blank list box.What is the best way to do this? hope this make
                      > sense[/color]

                      When you said the above in your first post, I assume you mean you want to
                      get ALL surnames that match the selected forename, not just the first one
                      you come to.
                      [color=blue]
                      > For count = 0 To number
                      > If lstFullNames.Li st(count) = namestr Then
                      > flag = True
                      > End If
                      > Next count
                      > If flag = False Then
                      > MsgBox ("name is not in the list")
                      > Else
                      > Let namestr2 = Len(namestr)
                      > Let namestr1 = InStr(1, namestr, " ")
                      > Let namestr3 = Left$(namestr, namestr1)
                      > lstsurnames.Add Item (namestr3)
                      > End If
                      > End Sub[/color]

                      In the above code snippet that you posted earlier, which I took the liberty
                      to reformat to make it easier to read (something you should think about in
                      your future coding), you need to add the names to the lstsurnames ListBox
                      while inside the For-Next loop (you can't see each separate thing you found
                      after the loop has finished; unless, of course, you store each found item in
                      an array for later processing). Move the assignment statements in your Else
                      block of code into the If-Then block inside of your For-Next loop; however,
                      you need to change what you are actually assigning... use
                      lstFullNames.Li st(count) and not namestr, that is what you want to split
                      apart. Also, the assignment for namestr3 will include a blank space after it
                      because the position you found the blank at is used as the count argument in
                      the Left$ statement... you want to use one less than that count value so
                      that you don't grab the blank character.

                      Rick - MVP


                      "Kin®sole" <kinrsole@NOSPA Mhotmail.com> wrote in message
                      news:a8ecb9b06c 181cc23f62fdf6f b76c03f@news.te ranews.com...[color=blue]
                      > sorry that should read " but I can get this to work for each entry in the
                      > list."
                      >
                      > cheers
                      > "Kin®sole" <kinrsole@NOSPA Mhotmail.com> wrote in message
                      > news:0a5fcb02f5 0ed362b08064cd1 6b7f231@news.te ranews.com...[color=green]
                      > > As I say I an very new to VB.
                      > > The lists are just constructed at design time.
                      > > It is my collage homework but I have reached a point where I am stuck.I[/color]
                      > can[color=green]
                      > > not figure out how to search for part of a string i.e forename within a
                      > > list.I know I need to some how remove the surname form the fullname list[/color]
                      > but[color=green]
                      > > don't know how.
                      > > I thing I need to use ' INSTR' to find the space then use RIGHT$ to[/color][/color]
                      remove[color=blue][color=green]
                      > > the surname but I can get this to work for each entry in the list.
                      > > I'm only looking for a pointer!
                      > >
                      > > cheers
                      > >
                      > > "Larry Serflaten" <Abuse@SpamBust ers.com> wrote in message
                      > > news:405ddde4_8 @corp.newsgroup s.com...[color=darkred]
                      > > >
                      > > > "Kin®sole" <kinrsole@NOSPA Mhotmail.com> wrote
                      > > > > OK here's my code so far.
                      > > >
                      > > > Just for your future reference:
                      > > >
                      > > > When you are looking for help with a problem, it often is beneficial
                      > > > to work up a small demo to reproduce the problem so that others
                      > > > can copy and paste the code into VB, to see it on their system.
                      > > >
                      > > > Some questions don't need a code example (Like; Where is the Help[/color][/color][/color]
                      file?)[color=blue][color=green][color=darkred]
                      > > > but those that are syntax or logic related often do need a example.
                      > > > Also, it often happens, that in the process of building a smaller demo
                      > > > of the problem, that the answer becomes apparent, and the problem is
                      > > > solved before it is even posted. It is a learning experience to break
                      > > > some problem down to just the bare necessities, and if you can't solve
                      > > > it then, you'll have a small demo to post for others to help find the
                      > > > answer. Thats why I ask for example code, it is far easier for you to
                      > > > show me the problem, than for me to guess at what you're doing,
                      > > > and sometimes the answer becomes apparent just by building the demo.
                      > > >
                      > > > Of course, another reason is because myself and other regular posters
                      > > > are also on the look out for students trying to get someone to do[/color][/color][/color]
                      their[color=blue][color=green][color=darkred]
                      > > > homework! ;-) If the student shows their work, adding a tweek here
                      > > > or there is generally enough to get through the 'problem'.
                      > > >
                      > > > LFS
                      > > >
                      > > >
                      > > >
                      > > >
                      > > >
                      > > >
                      > > > -----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
                      > > > http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
                      > > > -----== Over 100,000 Newsgroups - 19 Different Servers! =-----[/color]
                      > >
                      > >[/color]
                      >
                      >[/color]


                      Comment

                      • Kin®sole

                        #12
                        Re: String Manipulating within List

                        Thanks for your help so far.I seem to be heading in the right direction
                        now.Heres my code so far

                        Private Sub cmbForenames_Cl ick()
                        Dim namestr, namestr1, namestr2, namestr3, output, value, value1, value2 As
                        String
                        Dim num, number, count As Integer
                        Dim flag As Boolean

                        Let number = lstFullNames.Li stCount
                        Let num = cmbForenames.Li stIndex
                        Let namestr = cmbForenames.Li st(num)
                        Let namestr = LTrim$(namestr)
                        Let namestr = RTrim$(namestr)
                        Let namestr = UCase(Left$(nam estr, 1)) + Right$(namestr, Len(namestr) -
                        1)

                        For count = 0 To number
                        Let value2 = Len(lstFullName s.List(count))
                        Let value1 = InStr(1, (lstFullNames.L ist(count)), " ")
                        Let value = Right$((lstFull Names.List(coun t)), value2 -
                        value1)

                        If value = namestr Then
                        flag = True
                        If flag Then
                        Let lstFullNames.Li st(count) =
                        Left$((lstFullN ames.List(count )), value1 - 1)
                        lstsurnames.Add Item (lstFullNames.L ist(count))
                        End If
                        End If

                        Next count
                        If flag = False Then
                        MsgBox ("name is not in the list")
                        Else
                        End If

                        Ignoring all the string and integers Ive set my problem now is when I remove
                        the surname from ((lstFullNames. List(count)), it remove it from the actual
                        list .I have tried ((lstFullNames. List(count)) = newstring but without
                        success.

                        Sorry if these question seem a bit dumb but I'm not a natural programmer!!!

                        Thanks for the help so far
                        cheers
                        "Rick Rothstein" <rickNOSPAMnews @NOSPAMcomcast. net> wrote in message
                        news:tJ-dnYo396TsdcDdRV n-gg@comcast.com. ..[color=blue][color=green]
                        > > I have two lists one blank and one containing names in the format of[/color]
                        > surname[color=green]
                        > > and then forename.I also have a combo box containing forenames.When I
                        > > select a forename from my combo box I need to add the corresponding[/color]
                        > surname[color=green]
                        > > into the blank list box.What is the best way to do this? hope this make
                        > > sense[/color]
                        >
                        > When you said the above in your first post, I assume you mean you want to
                        > get ALL surnames that match the selected forename, not just the first one
                        > you come to.
                        >[color=green]
                        > > For count = 0 To number
                        > > If lstFullNames.Li st(count) = namestr Then
                        > > flag = True
                        > > End If
                        > > Next count
                        > > If flag = False Then
                        > > MsgBox ("name is not in the list")
                        > > Else
                        > > Let namestr2 = Len(namestr)
                        > > Let namestr1 = InStr(1, namestr, " ")
                        > > Let namestr3 = Left$(namestr, namestr1)
                        > > lstsurnames.Add Item (namestr3)
                        > > End If
                        > > End Sub[/color]
                        >
                        > In the above code snippet that you posted earlier, which I took the[/color]
                        liberty[color=blue]
                        > to reformat to make it easier to read (something you should think about in
                        > your future coding), you need to add the names to the lstsurnames ListBox
                        > while inside the For-Next loop (you can't see each separate thing you[/color]
                        found[color=blue]
                        > after the loop has finished; unless, of course, you store each found item[/color]
                        in[color=blue]
                        > an array for later processing). Move the assignment statements in your[/color]
                        Else[color=blue]
                        > block of code into the If-Then block inside of your For-Next loop;[/color]
                        however,[color=blue]
                        > you need to change what you are actually assigning... use
                        > lstFullNames.Li st(count) and not namestr, that is what you want to split
                        > apart. Also, the assignment for namestr3 will include a blank space after[/color]
                        it[color=blue]
                        > because the position you found the blank at is used as the count argument[/color]
                        in[color=blue]
                        > the Left$ statement... you want to use one less than that count value so
                        > that you don't grab the blank character.
                        >
                        > Rick - MVP
                        >
                        >
                        > "Kin®sole" <kinrsole@NOSPA Mhotmail.com> wrote in message
                        > news:a8ecb9b06c 181cc23f62fdf6f b76c03f@news.te ranews.com...[color=green]
                        > > sorry that should read " but I can get this to work for each entry in[/color][/color]
                        the[color=blue][color=green]
                        > > list."
                        > >
                        > > cheers
                        > > "Kin®sole" <kinrsole@NOSPA Mhotmail.com> wrote in message
                        > > news:0a5fcb02f5 0ed362b08064cd1 6b7f231@news.te ranews.com...[color=darkred]
                        > > > As I say I an very new to VB.
                        > > > The lists are just constructed at design time.
                        > > > It is my collage homework but I have reached a point where I am[/color][/color][/color]
                        stuck.I[color=blue][color=green]
                        > > can[color=darkred]
                        > > > not figure out how to search for part of a string i.e forename within[/color][/color][/color]
                        a[color=blue][color=green][color=darkred]
                        > > > list.I know I need to some how remove the surname form the fullname[/color][/color][/color]
                        list[color=blue][color=green]
                        > > but[color=darkred]
                        > > > don't know how.
                        > > > I thing I need to use ' INSTR' to find the space then use RIGHT$ to[/color][/color]
                        > remove[color=green][color=darkred]
                        > > > the surname but I can get this to work for each entry in the list.
                        > > > I'm only looking for a pointer!
                        > > >
                        > > > cheers
                        > > >
                        > > > "Larry Serflaten" <Abuse@SpamBust ers.com> wrote in message
                        > > > news:405ddde4_8 @corp.newsgroup s.com...
                        > > > >
                        > > > > "Kin®sole" <kinrsole@NOSPA Mhotmail.com> wrote
                        > > > > > OK here's my code so far.
                        > > > >
                        > > > > Just for your future reference:
                        > > > >
                        > > > > When you are looking for help with a problem, it often is beneficial
                        > > > > to work up a small demo to reproduce the problem so that others
                        > > > > can copy and paste the code into VB, to see it on their system.
                        > > > >
                        > > > > Some questions don't need a code example (Like; Where is the Help[/color][/color]
                        > file?)[color=green][color=darkred]
                        > > > > but those that are syntax or logic related often do need a example.
                        > > > > Also, it often happens, that in the process of building a smaller[/color][/color][/color]
                        demo[color=blue][color=green][color=darkred]
                        > > > > of the problem, that the answer becomes apparent, and the problem is
                        > > > > solved before it is even posted. It is a learning experience to[/color][/color][/color]
                        break[color=blue][color=green][color=darkred]
                        > > > > some problem down to just the bare necessities, and if you can't[/color][/color][/color]
                        solve[color=blue][color=green][color=darkred]
                        > > > > it then, you'll have a small demo to post for others to help find[/color][/color][/color]
                        the[color=blue][color=green][color=darkred]
                        > > > > answer. Thats why I ask for example code, it is far easier for you[/color][/color][/color]
                        to[color=blue][color=green][color=darkred]
                        > > > > show me the problem, than for me to guess at what you're doing,
                        > > > > and sometimes the answer becomes apparent just by building the demo.
                        > > > >
                        > > > > Of course, another reason is because myself and other regular[/color][/color][/color]
                        posters[color=blue][color=green][color=darkred]
                        > > > > are also on the look out for students trying to get someone to do[/color][/color]
                        > their[color=green][color=darkred]
                        > > > > homework! ;-) If the student shows their work, adding a tweek here
                        > > > > or there is generally enough to get through the 'problem'.
                        > > > >
                        > > > > LFS
                        > > > >
                        > > > >
                        > > > >
                        > > > >
                        > > > >
                        > > > >
                        > > > > -----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
                        > > > > http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
                        > > > > -----== Over 100,000 Newsgroups - 19 Different Servers! =-----
                        > > >
                        > > >[/color]
                        > >
                        > >[/color]
                        >
                        >[/color]


                        Comment

                        • Kin®sole

                          #13
                          Re: String Manipulating within List


                          It will now do what I need it to do.I should have tried newstring
                          =(lstfullnames. list(count))

                          thanks for all your help.
                          That's part one of three complete lol
                          only two more to do.
                          thanks again

                          Cheers[color=blue]
                          >
                          >[/color]


                          Comment

                          Working...