Hi all!
I am writting beacause I desperately want your help..
I want to connect 3 comboboxes. I have a table which contains Streetnames, Post Codes and Municipalities. I want to choose the Streetname from the first combobox something that I have done. The second Combobox I want to display the possible Post Codes. The problem is that the same streetname may belongs to more than one municipality which means that one streetname should display more than one post code at combobox 2 and more than one municiality in combobox 3. I attach my code till now..I achieved to fill the first combo box and i need your help for the second one.. What I do wrong??

Dim StreetNameDA As New SqlDataAdapter()
        Dim DSstreetName1 As New AMRtoSQLDataSet
        'DSstreetName1.Clear()
        'Select Street Names
        StreetNameDA.SelectCommand = New SqlCommand()
        StreetNameDA.SelectCommand.Connection = conn
        StreetNameDA.SelectCommand.CommandText = "SELECT StreetName_LCL FROM     T_MUNICIPALITY_STREETS order by StreetName_LCL"

        StreetNameDA.Fill(DSstreetName1, "StreetNameTable")


        '-------------Fill combo box StreeName1
        'Dim PC As String
        cboStreetName1.DataSource = DSstreetName1.Tables("StreetNameTable")
        cboStreetName1.DisplayMember = "StreetName_LCL"
        ' PC = cboStreetName1.ValueMember
        cboStreetName1.ValueMember = "StreetName_LCL"
        Me.cboStreetName1.SelectedValue = 0

'-------------fill post code combobox

Dim PostcodeDA As New SqlDataAdapter()
        Dim DSpostcode As New AMRtoSQLDataSet
        ' DSpostcode.Clear()
        ' Dim SN As String
        PostcodeDA.SelectCommand = New SqlCommand()
        PostcodeDA.SelectCommand.Connection = conn
        PostcodeDA.SelectCommand.CommandText = "SELECT Postcode,StreetName_LCL FROM T_MUNICIPALITY_STREETS WHERE StreetName_LCL= '" & cboStreetName1.SelectedIndex.ToString & "'"
        PostcodeDA.Fill(DSpostcode, "PostcodeTable")
        cboPostcode.DataSource = DSpostcode.Tables("PostcodeTable")
        cboPostcode.DisplayMember = "Postcode"
        cboPostcode.ValueMember = "Postcode"
        cboPostcode.SelectedValue = 0

Line 28 should be cboStreetName1.Text. .selectedindex.tostring returns the number of the selected index. As a debugging hint, I often use MessageBox.Show to make sure I am getting the value that I am expecting as in MessageBox.Show(cboStreetName1.SelectedIndex.ToString)

I am assuming that you are wrapping lines 22-33 in a SelectedIndexChanged block so it will load the proper values when they select a different street.

One other comment. Since you initialize the .SelectedValue to 0, this works as expected.

Be aware that if you do not initialize it, the value is -1 and trying to retrieve the text when ComboBox.SelectedValue = -1 will blow up.

This question has already been answered. Start a new discussion instead.