Solved

vb.net Disable Treenode selection in Treeview

Posted on 2006-10-30
1
2,567 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

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

Displaying an arrayList in a listView using the default adapter is rarely the best solution. To get full control of your display data, and to be able to refresh it after editing, requires the use of a custom adapter.
Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
An introduction to basic programming syntax in Java by creating a simple program. Viewers can follow the tutorial as they create their first class in Java. Definitions and explanations about each element are given to help prepare viewers for future …
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 …

757 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now