|
在click事件里设置了ListBox1.Selected(0) = False,但是第一行还是显示被选中的,用按钮操作第二行是正常显示的。
- Private Sub CommandButton1_Click()
- If ListBox1.Selected(1) = True Then
- ListBox1.Selected(1) = False
- End If
- End Sub
- Private Sub CommandButton2_Click()
- MsgBox "ListBox1.ListIndex = " & ListBox1.ListIndex
- End Sub
- Private Sub ListBox1_Click()
- If ListBox1.Selected(0) = True Then
- ListBox1.Selected(0) = False
- End If
- End Sub
- Private Sub UserForm_Initialize()
- ListBox1.ColumnCount = 2
- ListBox1.AddItem
- ListBox1.List(0, 0) = 0
- ListBox1.List(0, 1) = 1
- ListBox1.AddItem
- ListBox1.List(1, 0) = 0
- ListBox1.List(1, 1) = 2
- End Sub
复制代码
Book1.zip
(11.2 KB, 下载次数: 16)
|
|