Skip to content
MPGHThe Dark Arts
/
RegisterLog in
Forum
Community
What's NewLatest posts across the boardTrendingHottest threads right nowSubscribedThreads you follow
Discussion
GeneralIntroductionsEntertainmentDebate FortFlaming & Rage
Board
News & AnnouncementsMPGH TimesSuggestions & HelpGiveaways
More Sections
Art & Graphic DesignProgrammingHackingCryptocurrency
Hacks & Cheats
Games
ValorantCS2 / CS:GOCall of Duty / WarzoneFortniteApex LegendsEscape From Tarkov
+14 moreLeague of LegendsGTA VMinecraftRustROTMGBattlefieldTroveBattleOnCombat ArmsCrossFireBlackshotRuneScapeDayZDead by Daylight
Resources
Game Hacking TutorialsReverse EngineeringGeneral Game HackingAnti-CheatConsole Game Hacking
Tools
Game Hacking ToolsTrainers & CheatsHack/Release NewsNew
Submit a release →Share your cheat, tool, or config with the community.
AINEW
AI Tools
General & DiscussionPrompt EngineeringLLM JailbreaksHotAI Agents & AutomationLocal / Open Models
AI × Gaming
AI Aimbots & VisionML Anti-CheatGame Bots & Automation
Create
AI Coding / Vibe CodingAI Art & MediaAI Voice & TTS
The AI frontier →Where game hacking meets modern machine learning. Jump in.
Marketplace
Buy & Sell
SellingBuyingTradingUser Services
Trust & Safety
Middleman LoungeMarketplace TalkVouch Copy Profiles
Money
Cryptocurrency TalkCurrency ExchangeWork & Job Offers
Start selling →List accounts, services, and goods. Use the middleman to trade safe.
MPGH The Dark Arts

A community for offensive security research, reverse engineering, and AI.

Community

ForumMarketplaceSearch

Account

RegisterLog in

Legal

Privacy PolicyForum RulesHelp & FAQ
© 2026 MPGH · All rights reserved.Built by the community, for the community. For educational purposes onlyContent is shared for security research and education — we don't condone illegal use. You're responsible for complying with applicable laws. Use at your own risk.
Home › Forum › Programming › Visual Basic Programming › [Help]Treeview Search Button[Solved]

[Help]Treeview Search Button[Solved]

Posts 1–7 of 7 · Page 1 of 1
MO
ModelCookie2
[Help]Treeview Search Button[Solved]
How to I make a search button with a textbox for a TreeView?

Ex: I write "Age Of Empires" in the textbox and when I click SEARCH, i want that it selects the root or the child that has Age of Empires in the named.

Thanks
#1 · 15y ago
Hassan
Hassan
First add this function to your form:

Code:
Private Sub FindNodes(ByVal n As TreeNode)
        Dim x As TreeNode
        For Each x In n.Nodes
            If x.Text = Me.TextBox1.Text Then
                x.BackColor = Color.Indigo
                x.Parent.ExpandAll()
            End If
            FindNodes(x)
        Next
    End Sub
Then double click textbox1 and add the following code to it (Textbox_TextChanged Event):

Code:
Dim nodes As TreeNodeCollection = TreeView2.Nodes
        Dim n As TreeNode
        For Each n In nodes
            FindNodes(n)
        Next
Will expand and highlight all roots and children containing the specified words !!
#2 · 15y ago
MO
ModelCookie2
It doesnt work , when i click search , nothing happens?

*EDIT* it works but only when i type a cd key.
ex: i want that when i type Age of Mythology and I click search, it selects the text because now it only select the child (cd-key) and not the root (games)
#3 · edited 15y ago · 15y ago
Hassan
Hassan
Quote Originally Posted by ModelCookie2 View Post
It doesnt work , when i click search , nothing happens?

*EDIT* it works but only when i type a cd key.
ex: i want that when i type Age of Mythology and I click search, it selects the text because now it only select the child and not the root
OK Got It. Here's the final edited code:

Code:
Private Sub FindNodes(ByVal n As TreeNode)
        Dim x As TreeNode
        For Each x In n.Nodes
            x.BackColor = Color.White
        Next
        For Each x In n.Nodes
            If UCase(x.Text) = UCase(Me.TextBox1.Text) Then
                x.BackColor = Color.LightGray
                x.Parent.BackColor = Color.LightGray
                x.Parent.ExpandAll()
            End If
            FindNodes(x)
        Next
    End Sub
    Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged
        Dim nodes As TreeNodeCollection = TreeView2.Nodes
        Dim x As TreeNode
        For Each x In nodes
            x.BackColor = Color.White
        Next
        Dim n As TreeNode
        For Each n In nodes
            If UCase(n.Text) = UCase(TextBox1.Text) Then
                n.BackColor = Color.LightGray
            End If
            FindNodes(n)
        Next
    End Sub
Tested and working. Enjoy
#4 · 15y ago
MO
ModelCookie2
thanks bro!
#5 · 15y ago
Lolland
Lolland
It works?
#6 · 15y ago
Hassan
Hassan
Quote Originally Posted by Lolland View Post
It works?
If he said so, so yes !!
Mark it solved already xD
#7 · 15y ago
Posts 1–7 of 7 · Page 1 of 1

Post a Reply

Similar Threads

  • [Help]Click Image Button[Solved]By ppl2pass in Visual Basic Programming
    12Last post 16y ago
  • [Help]Search TextBox[Solved]By ppl2pass in Visual Basic Programming
    10Last post 16y ago
  • [Help] Hide Button [Solved]By Hahne in Visual Basic Programming
    3Last post 16y ago
  • [Help]Open link click of button[Solved]By iFrank1 in Visual Basic Programming
    7Last post 16y ago
  • [Help] Movable Buttons[Solved]By omghacker in Visual Basic Programming
    10Last post 15y ago

Tags for this Thread

None