Results 1 to 3 of 3

Thread: [RESOLVED] Sorting Win32_USBHub Results

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Dec 2007
    Location
    Somewhere else today
    Posts
    355

    Resolved [RESOLVED] Sorting Win32_USBHub Results

    The following code retrieves all USB hubs on a PC and adds them to a treeview:

    Code:
    Dim USBHubsearcher As New ManagementObjectSearcher("SELECT * FROM Win32_USBHub")
    
    For Each queryObj As ManagementObject In USBHubsearcher.Get()
        SystemTree.Nodes(0).Nodes("USBHUB").Nodes.Add(queryObj("Description"), queryObj("Description"), 4, 4)
    Next
    What I want to do is to sort the results by "Description" so that they are listed in alphabetical order. ORDER BY does not work as it is not part of WQL.

    Any help on this would be appreciated.

    Computerman
    It was much easier in VB6, but I am now liking Vb.Net alot more.

  2. #2
    New Member GinGin's Avatar
    Join Date
    Oct 2010
    Posts
    13

    Re: Sorting Win32_USBHub Results

    I've never used treeview before, but it seems to have a Treeview.Sort() method. Did you try that?

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Dec 2007
    Location
    Somewhere else today
    Posts
    355

    Re: Sorting Win32_USBHub Results

    OOPs. Forgot about treeview.sort.

    Computerman
    It was much easier in VB6, but I am now liking Vb.Net alot more.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width