Dim i As Integer, S As String
For i = 0 To Combo1.ListCount - 1
If InStr(1, Combo1.List(i), Combo1.Text, vbTextCompare) > 0 Then '如果組合框中已經存在該字母
MsgBox "該字母已存在!", , "提示"
Exit Sub
End If
Next
Combo1.AddItem Combo1.Text '否則追加數據到列表尾部
End Sub
'另:逐個提取combobox的列表list中的數據的代碼如下:
Dim i As Integer, S As String
For i = 0 To Combo1.ListCount - 1
s= Combo1.List(i)
msgbox "第" & i & "條記錄是:" s
End If
Next