Results 1 to 12 of 12

Thread: ComboBox Help

  1. #1

    Thread Starter
    Fanatic Member Dim's Avatar
    Join Date
    Jul 2000
    Posts
    620
    Ok heres the problem.
    I have a combobox and the Values for it are stored at a url.
    What i need to know is how to add items to the combo box. But see...i know how to do that.
    Code:
    Combobox1.AddItem Inet1.OpenURL ("url", icString)
    but the problem is, the values that i need are lined up like so:
    Need
    Need1
    Need2
    .
    .
    Does anyone know how i would go about adding those words to the combobox?
    Thank you,
    D!m

    [Edited by Dim on 07-12-2000 at 07:22 AM]
    Dim

  2. #2
    _______ HeSaidJoe's Avatar
    Join Date
    Jun 1999
    Location
    Canada
    Posts
    3,946

    <?>

    is this of any use...not sure when and how you are
    accessing the values..

    Private Sub Command1_Click()

    Dim x As Integer, i As Integer

    For i = 0 To 11
    Combo1.AddItem i
    If i = x Then
    List1.AddItem i
    x = x + 2
    End If
    Next


    End Sub
    "A myth is not the succession of individual images,
    but an integerated meaningful entity,
    reflecting a distinct aspect of the real world."

    ___ Adolf Jensen

  3. #3

    Thread Starter
    Fanatic Member Dim's Avatar
    Join Date
    Jul 2000
    Posts
    620
    Ok, maybe i'll explain it better this time.
    I have a remote file with text in it.
    Thing
    1
    Thing1
    2
    Thign2
    3
    Thing3
    .
    .
    .
    What i want is to add every first value to a combobox.
    I can add all of then to one line by using
    Combo1.AddItem iNet1.Open("url", icString)
    That adds all the values to one line thought, and i need only Thing1,Thing2, Thing3 added.
    Hope that explains it better.
    I can also get it so Only Thing1 Thing2 Thing3 Appear in the html file and have 1,2,3 in another.
    So it will be:
    Thing1
    Thing2
    Thing3
    .
    .
    .
    Any way i can add those things to the ComboBox?

    [Edited by Dim on 07-12-2000 at 07:56 AM]
    Dim

  4. #4
    _______ HeSaidJoe's Avatar
    Join Date
    Jun 1999
    Location
    Canada
    Posts
    3,946

    <?>

    'this is the principal of the matter
    'this will load every second record
    'you just have to adapt your code


    Private Sub Command1_Click()

    Dim x As Integer, i As Integer
    x = 1
    For i = 1 To 11
    Combo1.AddItem i
    If i = x Then
    List1.AddItem i
    x = x + 2
    End If
    Next

    End Sub

    Ie..
    open file
    i = 1
    x = 1
    while not eof(#1)
    if i = x then
    additem yourstring from your file
    x = x + 2
    etc...will give thing,thing1,thing2..as you
    are incrementing by 2


    "A myth is not the succession of individual images,
    but an integerated meaningful entity,
    reflecting a distinct aspect of the real world."

    ___ Adolf Jensen

  5. #5
    Frenzied Member Mark Sreeves's Avatar
    Join Date
    Nov 1999
    Location
    UK
    Posts
    1,845
    I think you need to read the page into a string and then spilt the string up into the parts you require and add them to the comobox.

    Without having some indication of what the url contains, I can't really help you any more than that.

    although if the page is a plain list of words with <BR> seperating them...
    Code:
    Dim words() As String
    Dim i As Integer
    Dim strtemp As String
    Dim strURL As String
    
      Inet1.AccessType = icUseDefault
      strURL = "http://graffiti.virgin.net/dms.mbs/words.htm"
    
      
     strtemp = Inet1.OpenURL(strURL, icString)
    
    
    words = Split(strtemp, "<BR>")
    
    For i = 0 To UBound(words)
      Combo1.AddItem words(i)
    Next
    Mark
    -------------------

  6. #6

    Thread Starter
    Fanatic Member Dim's Avatar
    Join Date
    Jul 2000
    Posts
    620
    I'm sorry it must be too early in the morning.
    Does this look right? It's adding numbers to the combo box though...i'm so lost
    Code:
    Dim x As Integer, i As Integer
            x = Inet1.OpenURL("url", icString)
        For i = 1 To 99
        Combo1.AddItem i
        If i = x Then
            List1.AddItem i
        x = x + 2
        End If
        Next
    Dim

  7. #7
    Frenzied Member Mark Sreeves's Avatar
    Join Date
    Nov 1999
    Location
    UK
    Posts
    1,845
    oh I nearly forgot!

    Split() is a VB6 function
    If you are using VB5 take a look at this:

    http://support.microsoft.com/support.../Q188/0/07.ASP
    Mark
    -------------------

  8. #8
    _______ HeSaidJoe's Avatar
    Join Date
    Jun 1999
    Location
    Canada
    Posts
    3,946

    <?>

    I think it's too early for me too
    this won't work..

    Dim x As Integer, i As Integer
    x = Inet1.OpenURL("url", icString)
    For i = 1 To 99
    Combo1.AddItem i
    If i = x Then
    List1.AddItem i
    x = x + 2
    End If
    Next

    send me the file via email and I'll play with it..
    type out one line of exactly what you want in the combo
    box as well




    "A myth is not the succession of individual images,
    but an integerated meaningful entity,
    reflecting a distinct aspect of the real world."

    ___ Adolf Jensen

  9. #9

    Thread Starter
    Fanatic Member Dim's Avatar
    Join Date
    Jul 2000
    Posts
    620
    The url is linking to a php file witch just lists the things
    Thing1
    Thing2
    Thing3
    Would i replace "<br>" with Chr$(13)?
    I need this asap please.
    The url is something like
    http://www.mcdonalds.com/getftp.php?...request=stores

    Thanx
    Dim

  10. #10
    Frenzied Member Mark Sreeves's Avatar
    Join Date
    Nov 1999
    Location
    UK
    Posts
    1,845
    Yes. Try it and see!


    The link you posted didn't find a file.
    Mark
    -------------------

  11. #11

    Thread Starter
    Fanatic Member Dim's Avatar
    Join Date
    Jul 2000
    Posts
    620
    omg i'm like gonna pass out here.
    I have
    Code:
    Dim words() As String
    Dim i As Integer
    Dim strtemp As String
    Dim strURL As String
    
      Inet1.AccessType = icUseDefault
      strURL = "http://www.mcdonalds.com/getftp.php?access=allow&request=stores"
      strtemp = Inet1.OpenURL(strURL, icString)
    words = Split(strtemp, Chr$(13))
    For i = 0 To UBound(words)
      Combo1.AddItem words(i)
    Next
    It still add the values all to one line in the combo box.
    I've tried puting Chr$(13) in quotes and it still add everything to one line.
    Someone come to my rescue PLZ, i'm dieing here.
    Ps. I can't show the real url.
    Thank you
    Dim

  12. #12

    Thread Starter
    Fanatic Member Dim's Avatar
    Join Date
    Jul 2000
    Posts
    620
    ok nm, i got that going, i just replaced Chr$(13) with <BR>
    now that's all working fine. Thank you very much Mark. I will be (most likely) posting a similar post in a couple hours, and maybe you can help me with that one also.

    Thank you,
    D!m
    Dim

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