Results 1 to 2 of 2

Thread: ackward loop Q [resolved]

  1. #1

    Thread Starter
    Junior Member VBnewbie2002's Avatar
    Join Date
    Sep 2002
    Posts
    29

    ackward loop Q [resolved]

    *edit* wow u guys are good..thanks


    i'm sending information over network w/ winsock and i want to take this information and put it in a listbox

    an example of how it comes in w/ Getdata

    Nick....]Joe....]Mike....]]

    whats between the name and the "]" is not important, i just used them to seperate the data
    and the double "]" at the end signifies the end of the data i need



    i want the listbox to have
    Nick....
    Joe.....
    Mike....


    i need help with a loop that will find the "]" and take the data up to that point, and then search after that point in the next run of the loop
    Do you understand? here's what i tried but it didn't work right
    Code:
    Do
    sTemp1 = Mid(sData, 10)
    sTemp2 = Mid(sTemp1, 1, InStr(1, sTemp1, "]") + 1)
    strX = Right(sTemp2, 2)
    sTemp3 = Left(sTemp2, Len(sTemp2) - 2)
    List1.AddItem sTemp3
    
    Loop Until strX = "]]"
    Last edited by VBnewbie2002; Apr 8th, 2003 at 05:43 PM.

  2. #2
    Addicted Member aldinator's Avatar
    Join Date
    May 2002
    Location
    Canada - better than all the rest!
    Posts
    216
    here:
    VB Code:
    1. Dim a() As String, k As Integer
    2. Const file = "Nick....]Joe....]Mike....]]"
    3. a() = Split(file, "]")
    4. For k = LBound(a) To UBound(a)
    5.     If a(k) <> "" Then
    6.         List1.AddItem a(k)
    7.     End If
    8. Next k

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width