Link to home
Create AccountLog in
.NET Programming

.NET Programming

--

Questions

--

Followers

Top Experts

Avatar of Tom Powers
Tom Powers

VB.net how to have combbox selection sort to the idenical treeview Node?
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.
User generated image
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

Open in new window

WinApp.png

Zero AI Policy

We believe in human intelligence. Our moderation policy strictly prohibits the use of LLM content in our Q&A threads.


ASKER CERTIFIED SOLUTION
Avatar of Éric MoreauÉric Moreau🇨🇦

Link to home
membership
Log in or create a free account to see answer.
Signing up is free and takes 30 seconds. No credit card required.
Create Account

Avatar of Éric MoreauÉric Moreau🇨🇦

forgotten by the asker

Reward 1Reward 2Reward 3Reward 4Reward 5Reward 6

EARN REWARDS FOR ASKING, ANSWERING, AND MORE.

Earn free swag for participating on the platform.

.NET Programming

.NET Programming

--

Questions

--

Followers

Top Experts

The .NET Framework is not specific to any one programming language; rather, it includes a library of functions that allows developers to rapidly build applications. Several supported languages include C#, VB.NET, C++ or ASP.NET.