Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Listbox Question

Status
Not open for further replies.

Netman06

Technical User
Aug 15, 2006
70
US
Hello,

How do I check to see if Netstat is selected in the Listbox.

Here is the code I'm using.

Private Sub ListBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ListBox1.SelectedIndexChanged
If ListBox1.SelectedItem = Netstat Then


End If
End Sub
 
Is "NetStat" a string value in the listbox? If yes then try this

Code:
        Dim bolNetStat As Boolean
        Try
            If Me.ListBox1.SelectedItem.ToString = "NetStat" Then
                bolNetStat = True
            Else
                bolNetStat = False
            End If
            MessageBox.Show(bolNetStat)
        Catch ex As Exception
            MessageBox.Show(ex.Message)
        Finally

        End Try

________________________________________________________
Zameer Abdulla
Help to find Missing people
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top