We help IT Professionals succeed at work.

VB.NET LIST NETWORK ADAPTERS AND DRIVERS

828 Views
Last Modified: 2012-05-08
I have this code and I wanted it to list the network adapters and their driver but my code doesn't seem to list anything at all.

How can I fix my code?
 Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click 
        Try
            Dim searcher As New ManagementObjectSearcher( _
            "root\CIMV2", _
            "SELECT * FROM Win32_NetworkAdapter")
            For Each queryObj As ManagementObject In searcher.Get() 
                ListBox2.Items.Add("-----------------------------------")
                ListBox2.Items.Add("Win32_NetworkAdapter instance")
                ListBox2.Items.Add("-----------------------------------")
                ListBox2.Items.Add("AdapterType: " & queryObj("AdapterType"))
            Next
        Catch err As ManagementException
            ListBox2.Items.Add("An error occurred while querying for WMI data: " & err.Message)
        End Try
    End Sub

Open in new window

Comment
Watch Question

HelpDesk / Programmer
CERTIFIED EXPERT
Commented:
This one is on us!
(Get your first solution completely free - no credit card required)
UNLOCK SOLUTION
Unlock the solution to this question.
Join our community and discover your potential

Experts Exchange is the only place where you can interact directly with leading experts in the technology field. Become a member today and access the collective knowledge of thousands of technology experts.

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.