Vb.net InvalidArgument=的值';2';对';无效;指数';

Vb.net InvalidArgument=的值';2';对';无效;指数';,vb.net,combobox,indexing,Vb.net,Combobox,Indexing,我无法理解你的消息来源和事件发生的地点。但您知道,在一个组合框中需要3个项目才能访问索引为2的项目?!每个集合都从0开始。好-我发现这些行是错误的“group11\u 2\u count=group1\u 2\u count+1”这应该是“group11\u 2\u count=group11\u 2\u count+1”和“group11\u 1\u count=group1\u count+1”,应该是“group11\u 1\u count=group11\u 1\u count+1”谢谢

我无法理解你的消息来源和事件发生的地点。但您知道,在一个组合框中需要3个项目才能访问索引为2的项目?!每个集合都从0开始。

好-我发现这些行是错误的“group11\u 2\u count=group1\u 2\u count+1”这应该是“group11\u 2\u count=group11\u 2\u count+1”和“group11\u 1\u count=group1\u count+1”,应该是“group11\u 1\u count=group11\u 1\u count+1”谢谢你的回复,我自己已经弄明白了……这些行是错误的“group11\u 2\u count=group1\u 2\u count+1”应该是“group11\u 2\u count=group11\u 2\u count+1”,还有“group11\u 1\u count=group1\u count+1”,应该是“group11\u 1\u count=group11\u 1\u count+1”
Dim group11_0_count = 0
        Dim group11_1_count = 0
        Dim group11_2_count = 0

        Dim m As Integer = 0
        Dim n As Integer = 0
        Dim increment2 As Integer


        For m = 0 To machings2.Items.Count - 1
            For n = 0 To 3
                If machings2.Items(m).ToString.Chars(n) = "1" Then
                    increment2 = increment2 + 1
                End If
            Next
            If (increment2 = 0) Then
                group11_0_count = group11_0_count + 1
                group11_1_0.Items.Add(machings2.Items(m))
            End If

            If (increment2 = 1) Then
                group11_1_count = group1_1_count + 1
                group11_1_1.Items.Add(machings2.Items(m))
            End If

            If (increment2 = 2) Then
                group11_2_count = group1_2_count + 1
                group11_1_2.Items.Add(machings2.Items(m))
            End If
            increment2 = 0
        Next

        If (group11_0_count > 0 AndAlso group11_1_count > 0) Then
            Dim result = ""
            Dim index As Integer = 0
            Dim gg As Integer = 0
            Dim hh As Integer = 0
            Dim i As Integer = 0
            For hh = 0 To group11_1_count - 1
                For gg = 0 To group11_0_count - 1
                    result = ""
                    index = 0
                    For i = 0 To 3
                        If group11_1_0.Items(gg).ToString.Chars(i) <> group11_1_1.Items(hh).ToString.Chars(i) Then
                            result &= "-"
                            index = index + 1
                        Else
                            result &= group11_1_0.Items(gg).ToString.Chars(i)
                        End If
                    Next

                    If (index = 1) Then
                        machings3.Items.Add(result)
                    End If
                Next
            Next
        End If
combobox1 items
0000

combobox items
0001
0010

the result will be like that in machings3 combobox
000-
00-0

Here the differnce between two items indicated by - sign

But i am getting InvalidArgument=Value of '2' is not valid for 'index'.