我的问题就在于此。 VB要求我声明它,但那不是我想要的。我试图添加所有如果尚未在组合框的列表框中。最后说我添加了多少。
'Delcare
Dim bolItemFound As Boolean
Dim intCounter As Integer
'Adding all items not already listed
For i = 0 To lstToPackItems.Items.Count - 1
For j() = 0 To cboStandardToPackItems.Items.Count - 1
If lstToPackItems.Items.Count < 0 Then
lstToPackItems.Items.Add(cboStandardToPackItems.Items)
End If
Exit Sub
If lstToPackItems.Items(i).ToString.ToUpper = cboStandardToPackItems.Items(j).ToString.ToUpper Then
bolItemFound = True
End If
Exit Sub
Next
If bolItemFound = False Then
'add item
intCounter += 1
lstToPackItems.Items.Add(cboStandardToPackItems.Items(j))
MsgBox("You have successfuly added " & intCounter & " item(s) to your list box!")
End If
Next
答案 0 :(得分:0)
在这一行:
For j() = 0 To cboStandardToPackItems.Items.Count - 1
j
之后你不应该有括号。