Hi everyone,

I have a 2 ComboBox with DropDownList style. 1st one collection is 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15 and the other one collection is 2,3,4,5,6,7,8,9,10,11,12,13,14,15. For example when I choose "2" in 1st ComboBox, 2nd one must be change to "2" if the selected item smaller then 1st ComboBox and when I choose "6" in 2nd ComboBox first ComboBox must be only one smaller then it like "5". These are examples. My problem is everything is perfect if I choose 1 to 8 but if I choose 9 to 15 doesn't change the other ComboBox

Here is my Code:

Code:
    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        ComboBox1.SelectedIndex = 3
        ComboBox2.SelectedIndex = 5
    End Sub

    Private Sub ComboBox2_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles ComboBox2.SelectedIndexChanged
        Dim XxXStart, XxXEnd
        XxXStart = ComboBox1.SelectedItem
        XxXEnd = ComboBox2.SelectedItem

        If XxXEnd < XxXStart Then
            ComboBox1.SelectedIndex = ComboBox2.SelectedIndex + 1
        End If
    End Sub

    Private Sub ComboBox1_SelectedValueChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles ComboBox1.SelectedValueChanged
        Dim YyYStart, YyYEnd
        YyYStart = ComboBox1.SelectedItem
        YyYEnd = ComboBox2.SelectedItem

        If YyYStart > YyYEnd Then
            ComboBox2.SelectedIndex = ComboBox1.SelectedIndex - 1
        End If
    End Sub
I'm confused in that code, I realy don't know how can I fix it