Solved

vb.net Disable Treenode selection in Treeview

Posted on 2006-10-30
1
2,607 Views
Last Modified: 2012-06-27
I want to be able to select a treenode and during the treeview after select event I want to disable the user from selecting (highlighting) other treenodes.  I want to disable the user from selecting other treenodes because I am loading a tiff file during the after select event.  How can This be done?  I have tried adding and removing the event handlers for after and before selection, but other treenodes become highlighted while I am loading my tiff file.
0
Comment
Question by:OFGemini
1 Comment
 
LVL 19

Accepted Solution

by:
VoteyDisciple earned 250 total points
ID: 17835780
The TreeView.BeforeSelect event gives you the option to cancel selection, you just have to know when to do it.

If you create the event handler like this you should be ok:

Private Sub TreeView1_BeforeSelect(sender as Object, e as TreeViewCancelEventArgs) _
     Handles TreeView1.BeforeSelect

     If (loading) Then e.Cancel = True
End Sub

Private Sub LoadingTiff()
     loading = True
     ' Do whatever you have to do to load the tiff
     loading = False
End Sub

Protected loading As Boolean = False
0

Featured Post

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
topping2 challenge 13 91
wordcount challenge 11 121
Filename to be appended with DateTimeof Download 3 55
Change the background and font colors in Notepad++ 5 85
Does the idea of dealing with bits scare or confuse you? Does it seem like a waste of time in an age where we all have terabytes of storage? If so, you're missing out on one of the core tools in every professional programmer's toolbox. Learn how to …
Entering a date in Microsoft Access can be tricky. A typo can cause month and day to be shuffled, entering the day only causes an error, as does entering, say, day 31 in June. This article shows how an inputmask supported by code can help the user a…
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question