' 得先选中ListBox中的某一项Option ExplicitPrivate Sub Command1_Click() Select Case List1.Text Case "关机" Debug.Print "关机" Case "重启" Debug.Print "重启" End Select End SubPrivate Sub Form_Load() List1.AddItem "关机" List1.AddItem "重启" List1.ListIndex = 0 End Sub
if keyascii = 13 then Select Case List1.Text Case "关机" Debug.Print "关机" Case "重启" Debug.Print "重启" End Select endif 13 可以变成 any keyascii,此程序要在listbox的keyascii过程中写我认为应该好用
我的问题现在就是List1.Text这个值,也可以输出List1.Text,但就是不能用来比较,下面这样的语句也不能用。 if List1.Text="关机" then '...... end if一定要用下标的方式才行......
Select Case List1.Text
Case "关机"
Debug.Print "关机"
Case "重启"
Debug.Print "重启"
End Select
End SubPrivate Sub Form_Load()
List1.AddItem "关机"
List1.AddItem "重启"
List1.ListIndex = 0
End Sub
Select Case List1.Text
Case "关机"
Debug.Print "关机"
Case "重启"
Debug.Print "重启"
End Select
endif
13 可以变成 any keyascii,此程序要在listbox的keyascii过程中写我认为应该好用
if List1.Text="关机" then
'......
end if一定要用下标的方式才行......
'......
end if可以比较