Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

vb.net Disable Treenode selection in Treeview

Posted on 2006-10-30
1
Medium Priority
?
2,758 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 1000 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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

If you’re thinking to yourself “That description sounds a lot like two people doing the work that one could accomplish,” you’re not alone.
Although it can be difficult to imagine, someday your child will have a career of his or her own. He or she will likely start a family, buy a home and start having their own children. So, while being a kid is still extremely important, it’s also …
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
Screencast - Getting to Know the Pipeline

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