String Array to combobox?

tjbarr

New member
Joined
Nov 19, 2008
Messages
3
Programming Experience
3-5
I have a listbox and depending on what they pick on the listbox the combobox is loaded. I now want to change the combo box to be loaded from a string array - how do I do this?
Here is my array:


VB.NET:
 Dim strTitles() As String = {"Advanced VB 2005", "Office 2007", "Object-Oriented Modeling with UML", "Object-Oriented Software Engineering", "VB.NET for Business", "VB 2008"}




 Dim strSubject As String
        strSubject = ""

        strSubject = CStr(lstSubject.SelectedItem)


        Select Case strSubject
            Case "Introduction to Computers"
                cboBooks.Items.Clear()
                cboBooks.Items.Add(conOFFICE2007)


            Case "Beginning Programming"
                cboBooks.Items.Clear()
                cboBooks.Items.Add(conVB2008)
                cboBooks.Items.Add(conVBNET)


            Case "Intermediate Programming"
                cboBooks.Items.Clear()
                cboBooks.Items.Add(conADVVB2005)


            Case "Systems Analysis"
                cboBooks.Items.Clear()
                cboBooks.Items.Add(conOOSOFTENG)
                cboBooks.Items.Add(conOOMODELING)

        End Select
 
Try this:

VB.NET:
Dim array1() As String = {"One", "Three", "Five", "Seven"}
Dim array2() As String = {"Two", "Four", "Six", "Eight"}

Me.ComboBox1.Items.Clear()

Me.ComboBox1.Items.AddRange(array1)
Me.ComboBox1.Items.AddRange(array2)
 
Back
Top