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
572 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
  • 2
  • 2
5 Comments
 
LVL 85

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

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

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

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…
It seems a simple enough task, yet I see repeated questions asking how to do it: how to pass data between two forms. In this article, I will show you the different mechanisms available for you to do just that. This article is directed towards the .N…
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

777 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