Solved

Directory Treeview; How do I get "AfterSelect" on same node a second time when user reselects same node

Posted on 2004-09-01
5
580 Views
Last Modified: 2008-02-01
The order of activity when selecting a node is:

1. Click Event
2. After Select

I have an app that reuires the user to select an option for the folder before selecting the folder

so, the process is:

Select option
Select folder

the result is
1. click event
2. after select event

my app works on after select event, however if user makes wrong choice & I want to give a second chance without refreshing the whole directory tree, when the user re-selects the node, all I get is a click event

How do I refresh the node so I get the after select event the second time without refreshing the whole tree & the user having to trail through all the nodes again?
0
Comment
Question by:bemson
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
5 Comments
 
LVL 86

Expert Comment

by:Mike Tomlinson
ID: 11958613
One approach is to use the MouseDown event instead of the click or after select events:

    Private Sub TreeView1_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles TreeView1.MouseDown
        Dim n As TreeNode = TreeView1.GetNodeAt(e.X, e.Y)
        If Not (n Is Nothing) Then
            ' do something with n...
        End If
    End Sub

Idle_Mind
0
 
LVL 10

Accepted Solution

by:
EBatista earned 125 total points
ID: 11959332
set the SelectedNodes property to nothing (or null for c#)

'vb
Treview1.SelectedNodes=nothing

//c#
Treview1.SelectedNodes=null;

regards
Elio
0
 

Author Comment

by:bemson
ID: 11961103
Thanks to Idle Mind & EBatista for your contributions

For Idle Mind:
Your solution appears to be the logical & technical answer & has some merit although using the mousedown event caused an error in the following code I had in the After Select event

The Code I had was: FolderName = e.Node.FullPath

Using the mouse event caused the e.Node.FullPath to generate an error as e is now not a part of System.Windows.Forms.TreeviewEventArgs

e is now a MouseEventArgs which does not give me the path

For EBatista:

A simple solution that resolves my problem, Thank you
0
 

Author Comment

by:bemson
ID: 11961114
Just a small point for EBatista

the code I used was Treview1.SelectedNode=nothing

no s on nodes

Thanks again
0
 
LVL 10

Expert Comment

by:EBatista
ID: 11961970
good
:)
0

Featured Post

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

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

IP addresses can be stored in a database in any of several ways.  These ways may vary based on the volume of the data.  I was dealing with quite a large amount of data for user authentication purpose, and needed a way to minimize the storage.   …
Flash (http://en.wikipedia.org/wiki/Adobe_Flash) has evolved over the years to where it has become a masterful tool for displaying content screen.  It has excellent layout placement, UI precision as well as rendering capabilities. This, along with t…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

732 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