If have the following code:
For Each item As Object In Me.CheckedListBox2.CheckedItems
Dim PT As String = Me.CheckedListBox2.GetItemText(item)
If PT = "Port 1" Then
Port1.Sendkeys("command")
Port1.Sendkeys("{Enter}")
OtherSub()
End If
This part is so I can do threw each Item in the Checklistbox and add them to the command list.
Now I need to make an If statement that if nothing is selected it will run a default command.
If CheckedListBox2.SelectedValue = Nothing Then
Reset()
MsgBox("Wrong")
End If
This this what I tried my last attempt along with several other attempt that I have tried from varies code samples(What I could find) and forums. None will execute the Reset sub or MsgBox.
Other attempts:
If PT = "" Then
If PT = Nothing Then
If PT = " " Then
If CheckedListBox2.SelectedIndex = -1 Then
Any help if appreciated.
Aucun commentaire:
Enregistrer un commentaire