VB中list的问题?Private Sub Form_Load()List1.AddItem "Germany"List1.AddItem "India"List1.AddItem "France"List1.AddItem "Canada"List1.AddItem "USA"List1.AddItem "Japan"List1.AddItem "China"End Sub不用鼠标点中列表,怎么判断list中是不
来源:学生作业帮助网 编辑:六六作业网 时间:2024/12/23 16:11:05
VB中list的问题?Private Sub Form_Load()List1.AddItem "Germany"List1.AddItem "India"List1.AddItem "France"List1.AddItem "Canada"List1.AddItem "USA"List1.AddItem "Japan"List1.AddItem "China"End Sub不用鼠标点中列表,怎么判断list中是不
VB中list的问题?
Private Sub Form_Load()
List1.AddItem "Germany"
List1.AddItem "India"
List1.AddItem "France"
List1.AddItem "Canada"
List1.AddItem "USA"
List1.AddItem "Japan"
List1.AddItem "China"
End Sub
不用鼠标点中列表,怎么判断list中是不是存在china呢?
如果把china删去,又怎么判断不存在呢
VB中list的问题?Private Sub Form_Load()List1.AddItem "Germany"List1.AddItem "India"List1.AddItem "France"List1.AddItem "Canada"List1.AddItem "USA"List1.AddItem "Japan"List1.AddItem "China"End Sub不用鼠标点中列表,怎么判断list中是不
Private Sub Command1_Click()
Dim i%, a As String
a = "China"
For i = 1 To List1.ListCount
If a = List1.List(i) Then
Print "存在"
Exit Sub
End If
Next
For i = 0 To List1.ListCount - 1
If a = List1.List(i) Then
Print "存在"
Else
Print "不存在"
Exit Sub
End If
Next
End Sub
Private Sub Command2_Click()
Dim a As String, b As Integer
a = "China"
For i = 0 To List1.ListCount - 1
If a = List1.List(i) Then
b = i
List1.RemoveItem b
Exit Sub
End If
Next
End Sub
Private Sub Form_Load()
List1.AddItem "Germany"
List1.AddItem "India"
List1.AddItem "France"
List1.AddItem "Canada"
List1.AddItem "USA"
List1.AddItem "Japan"
List1.AddItem "China"
End Sub
很简单,只需添加两个控件(命令按钮名为“判断”“删除”),编辑窗体的单击事件就ok了,
我试过了,没问题