我创建了:
Public 123 As New Dictionary(Of String, Dictionary(Of String, Dictionary(Of String, Dictionary(Of String, Integer))))
现在我需要通过循环从Excel文件中完成此字典。但是,如果出现以下情况,我在3中的错误: “指定数量的参数与预期数量不匹配”
Dim search As Boolean = False
Dim counter As Integer = 2
Dim holder1 As String = "qwerty"
Dim holder2 As String = "qwerty"
Dim holder3 As String = "qwerty"
Dim holder4 As String = "qwerty"
While search = False
If String.IsNullOrEmpty(Sheet.Cells(counter, 1).Value) Then
search = True
End If
If Sheet.Cells(counter, 2).Text = holder1 Then
If Sheet.Cells(counter, 5).Text = holder2 Then
If Sheet.Cells(counter, 7).Text = holder3 Then
If Sheet.Cells(counter, 10).Text = holder4 Then
123(Sheet.Cells(counter, 2).Text(Sheet.Cells(counter, 5).Text(Sheet.Cells(counter, 7).Text(Sheet.Cells(counter, 10))))).Add(Sheet.Cells(counter, 10).Text, Sheet.Cells(counter, 8).Text)
Else
123(Sheet.Cells(counter, 2).Text(Sheet.Cells(counter, 5).Text(Sheet.Cells(counter, 7).Text))).Add(Sheet.Cells(counter, 10).Text, Sheet.Cells(counter, 8).Text)
holder4 = Sheet.Cells(counter, 10).Text
End If
Else
123(Sheet.Cells(counter, 2).Text(Sheet.Cells(counter, 5).Text)).Add(Sheet.Cells(counter, 7).Text, New Dictionary(Of String, Dictionary(Of String, Integer))) ERROR
holder3 = Sheet.Cells(counter, 7).Text
End If
Else
123(Sheet.Cells(counter, 2).Text).Add(Sheet.Cells(counter, 5).Text, New Dictionary(Of String, Dictionary(Of String, Integer)))
holder2 = Sheet.Cells(counter, 5).Text
End If
Else
123.Add(Sheet.Cells(counter, 2).Text, New Dictionary(Of String, Dictionary(Of String, Dictionary(Of String, Integer))))
holder1 = Sheet.Cells(counter, 2).Text
End If
counter += 1
End While