當前位置:編程學習大全網 - 網站源碼 - VB的combobox控件實現代碼

VB的combobox控件實現代碼

Private Sub Command1_Click()

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

  • 上一篇:hibernate源代碼在哪裏?
  • 下一篇:股票指標公式
  • copyright 2024編程學習大全網