Having some troubles with a program I'm writing. I'm using SharpDevelop, and I'm writing a VB.net program, that I am doing for a friend.

I have a combo box that has a list of races, that are already added (Human, Elf, Dark Elf, Draconian, Viera, Wingly). Upon selection, the appropriate jobs need to be listed. (Example: Wingly cannot be Berserkers, Viera cannot be Dark Knights, etc.)

How can I populate the second combo box when an option is selected in the first one?

Example:
Race Combo Box Contents: Human
Job Combo Box Contents:
Job 1
Job 2
Job 3
Job 4


Something like above, where Job 1, Job 2, etc. show up in the job combo box.

Then, on selection of a job in the job combo box, I want to populate a textbox/List grid with the abilities available to each level of a job, updating to show the relevant results for the selected job.

I'm not wanting to use SQL, or an Access Database to accomplish this. Any help will be gratefully accepted.

Nevermind, I found this answer. Took some looking, and some experimentation, but I figured it out.

Sorry for the trouble, if I have any more questions, I'll ask. Thanks!

P.S.: I used the following code, if anybody else has this problem:
From vbCity -
I created a new class file, and just named it Mylist. Inside that file put:

Public Class Mylist
    Private sName As String
    ' You can also declare this as String,bitmap or almost anything.
    ' If you change this delcaration you will also need to change the Sub New
    ' to reflect any change. Also the ItemData Property will need to be updated.
    Private iID As Integer

    ' Default empty constructor.
    Public Sub New()
        sName = ""
        ' This would need to be changed if you modified the declaration above.
        iID = 0
    End Sub

    Public Sub New(ByVal Name As String, ByVal ID As Integer)
        sName = Name
        iID = ID
    End Sub

    Public Property Name() As String
        Get
            Return sName
        End Get
        Set(ByVal sValue As String)
            sName = sValue
        End Set
    End Property

    ' This is the property that holds the extra data.
    Public Property ItemData() As Int32
        Get
            Return iID
        End Get
        Set(ByVal iValue As Int32)
            iID = iValue
        End Set
    End Property

    ' This is neccessary because the ListBox and ComboBox rely
    ' on this method when determining the text to display.
    Public Overrides Function ToString() As String
        Return sName
    End Function

End Class

To add the statements, I used:

With ComboBox1
    .Items.Add(New MyList("Item1", 1))
    .Items.Add(New MyList("Item2", 2))
    .Items.Add(New MyList("Item3", 3))
    .Items.Add(New MyList("Item4", 4))
    .SelectedIndex = 0 'Set first item as selected item.
End With

' The same goes for the listbox control
' Listboxcontrol with ItemData set as integer
With ListBox1
    .Items.Add(New MyList("Item1", 1))
    .Items.Add(New MyList("Item2", 2))
    .Items.Add(New MyList("Item3", 3))
    .Items.Add(New MyList("Item4", 4))
    .SelectedIndex = 0 'Set first item as selected item.
End With

I hope this helps.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.