troubleshooting Question

VB.net how to have combbox selection sort to the idenical treeview Node?

Avatar of Tom Powers
Tom Powers asked on
Visual Basic.NET* user controls.NET Programming
2 Comments1 Solution206 ViewsLast Modified:
I'm developing in VB.NET 2017 .NET 4.5.2
I just need the  combbox selection to sort to the idenical treeview Node? In my Combo box contains all the workstations in AD OU the Treeview has identical names as nodes I want when I combo box is selected the Computername becomes Highlighted in the Treeview Node. I can do it as combo box to sort to a listview however the Treeview is not a control that I can use it to it's Fullest.
Here is a Visual I got Tree to combo box but not combo box to Tree view.
Visual of what I described
hERE IS CODE THAT ALLOWED ME TO SORT FROM COMBO BOX TO lISTVIEW CONTROL. vb.net pLEASE
 Public Function FindItem(ByVal LV As ListView, ByVal TextToFind As String) As Integer



        ' Loop through LV’s ListViewItems.

        For i As Integer = 0 To LV.Items.Count - 1

            If Trim(LV.Items(i).Text) = Trim(TextToFind) Then

                ' If found, return the row number

                Return (i)

            End If

            For subitem As Integer = 0 To LV.Items(i).SubItems.Count - 1

                If Trim(LV.Items(i).SubItems(subitem).Text) = Trim(TextToFind) Then

                    ' If found, return the row number

                    Return (i)

                End If

            Next

        Next

        ' If not found, then return -1.     Return -1

    End Function
    Public Sub FindPrinter()
        LSPrinters.MultiSelect = False

        LSPrinters.FullRowSelect = True





        Dim checkInt As Integer = FindItem(LSPrinters, cmbPrint.Text)

        If checkInt <> -1 Then

            LSPrinters.Items(checkInt).Selected = True

            LSPrinters.Focus()
            LSPrinters.SelectedItems(0).EnsureVisible()


        Else
            ToolStripLabel1.Text = "Search string not found"

        End If


    End Sub
WinApp.png
ASKER CERTIFIED SOLUTION
Éric Moreau
Senior .Net Consultant
Join our community to see this answer!
Unlock 1 Answer and 2 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 2 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros