vb.net - populationg combo list

Discussion in 'OT Technology' started by SFLegend, Apr 18, 2005.

  1. SFLegend

    SFLegend .

    Joined:
    Sep 24, 2002
    Messages:
    263
    Likes Received:
    0
    Location:
    San Francisco
    is there an easy way to populate a combo list with elements from an array in visualbasic.net? I tried to use a for each loop, but this #@^#$ won't compile.

    Here's how the current code looks like:

    Code:
            
       Private Function populateListBox() As String
            Dim strEachCity As String
    
            For Each strEachCity In aryCityList
                cboCityList.Items.Add(strEachCity)
            Next strEachCity
        End Function
    I try to call the damn function, but it says "declaring expected" and won't compile.
     
  2. SLED

    SLED build an idiot proof device and someone else will

    Joined:
    Sep 20, 2001
    Messages:
    28,118
    Likes Received:
    0
    Location:
    AZ, like a bauce!
    compiled fine for me. :dunno: What line is it that the compiler is bitching about?
     
  3. Yep

    Yep Knick knack paddy whack, give the old dog a bone

    Joined:
    Jan 22, 2001
    Messages:
    4,603
    Likes Received:
    0
    Location:
    South Jersey
    Were are the values in aryCityList coming from?
     
  4. SFLegend

    SFLegend .

    Joined:
    Sep 24, 2002
    Messages:
    263
    Likes Received:
    0
    Location:
    San Francisco
    I put that "for each" loop on a procedure that executes when the form is opened and it worked.
     

Share This Page