一楼回答不错,但我想这个应用一般是要去掉重复数据的。因为我这台电脑没有装VB,去重复你的那个For循环可能有点错误,具体需要您在VB环境下调试下。
Private Sub Combo1_KeyPress(KeyAscii As Integer)
dim K as long
If KeyAscii = 13 Then
If IsNumeric(Combo1.Text) Then
for k=0 to combo1.listcount -1
if clng(combo1.list(k))=clng(combo1.text) then exit for
next
if k>= combo1.lsitcount then Combo1.AddItem Combo1.Text
Else
MsgBox Combo1.Text & " 不是数字!"
End If
End If
End Sub
Private Sub Combo1_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
If IsNumeric(Combo1.Text) Then
Combo1.AddItem Combo1.Text
Else
MsgBox Combo1.Text & " 不是数字!"
End If
End If
End Sub