473,382 Members | 1,180 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

Treeview Node Click

Hi All

I've got a treeview with checkboxes. I want the user to be able to
toggle the checkbox by click on the checkbox OR by clicking on the
node text.

So I've added an afterselect event handler to get the selected node
and change the .Checked property of the selected node as appropriate,
which works to change the .Checked status when the user FIRST clicks
on the text of a particular node.

But if they user then clicks on the text of the same node, the
afterselect event DOES NOT fire, because it was already selected I
guess. Can anyone tell me what other event I need to interpret that
click on the same node and then how to call the fire the afterselect
event handler from the click event handler?

Thanks.
Aug 28 '08 #1
2 4378
On Aug 28, 7:36*am, govolsb...@gmail.com wrote:
Hi All

I've got a treeview with checkboxes. *I want the user to be able to
toggle the checkbox by click on the checkbox OR by clicking on the
node text.

So I've added an afterselect event handler to get the selected node
and change the .Checked property of the selected node as appropriate,
which works to change the .Checked status when the user FIRST clicks
on the text of a particular node.

But if they user then clicks on the text of the same node, the
afterselect event DOES NOT fire, because it was already selected I
guess. *Can anyone tell me what other event I need to interpret that
click on the same node and then how to call the fire the afterselect
event handler from the click event handler?

Thanks.
Oh yeah, using afterselect doesn't really work because then it wants
to change the textbox if I get to the node by using the arrow keys to
navigate through the treeview. I only want it to change the checkbox
if I actually click on the node text.

I did try create a .NodeMouseClick event handler, but it seems to
think the selected node is the one I just came from rather than the
one I clicked on.

Thanks.
Aug 28 '08 #2
On Aug 28, 7:46*am, govolsb...@gmail.com wrote:
On Aug 28, 7:36*am, govolsb...@gmail.com wrote:
Hi All
I've got a treeview with checkboxes. *I want the user to be able to
toggle the checkbox by click on the checkbox OR by clicking on the
node text.
So I've added an afterselect event handler to get the selected node
and change the .Checked property of the selected node as appropriate,
which works to change the .Checked status when the user FIRST clicks
on the text of a particular node.
But if they user then clicks on the text of the same node, the
afterselect event DOES NOT fire, because it was already selected I
guess. *Can anyone tell me what other event I need to interpret that
click on the same node and then how to call the fire the afterselect
event handler from the click event handler?
Thanks.

Oh yeah, using afterselect doesn't really work because then it wants
to change the textbox if I get to the node by using the arrow keys to
navigate through the treeview. *I only want it to change the checkbox
if I actually click on the node text.

I did try create a .NodeMouseClick event handler, but it seems to
think the selected node is the one I just came from rather than the
one I clicked on.

Thanks.
LOL I love these kinds of posts. I first post my problem. Then I
find the solution on my own. Below, myNode ends up being the node
that the user clicked on. Before I was trying to interpret
the .SelectedNode property of sender (a treeview object).

Private Sub tvMEL_MouseClick(ByVal sender As Object, ByVal e As
System.Windows.Forms.TreeNodeMouseClickEventArgs) Handles
tvMEL.NodeMouseClick
Dim myNode As MELTreeNode = e.Node
End Sub
Aug 28 '08 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: .pd. | last post by:
I created a Windows form and stuck a toolbar on it with one button. I then added a treeView, docked it to the left of the form and enabled Label Edit. Here's the toolbar button click and after...
1
by: Aleksey | last post by:
Hi, All! I have a problem with TreeView component. My TreeView consists of two nodes Node1 and Node2. On click of right mouse button TreeView has event. In this event I check wich node is...
6
by: Tim | last post by:
Hi I have a form with a treeview on it. When I select a particular node it adds/shows a tab on the form. The treeview node remains selected as it should. The user can close the tab or remove the...
2
by: Srinivasa Raghavan | last post by:
Hi I am using ASP Tree View Control to display data in hiearchy fashion.I am having a checkbox next to the TreeView Node.When user checks or unchecks the nodes and click a button i am putting...
5
by: A-PK | last post by:
Hi, I am using treeview as my menu. my menu is like the following + Users & Groups - Users -Groups + Departmenuts - Engineering
14
by: Mr.D | last post by:
How do I save/load the contents of a Treeview to a file? I have found several good examples written i VB6, but not a single one for VB.NET. Please help. ---- Tim
0
by: Treeview Trouble | last post by:
I have an application where there are two radio buttons each of which populates a treeview control with a directory structure. Each radio button corresponds to a different directory which may or...
3
by: Shawn | last post by:
Hi. I'm working with the TreeView control in my ASP.NET 1.1 application. I have a problem I haven't been able to figure out. When I click on a node (not expand), whether it's a parent node, a...
18
by: =?Utf-8?B?TGkgV2VuZw==?= | last post by:
Hi, Is there a way for TreeView to have multiple selections? But I am not talking about its checked boxes. I want a way similar to ListView with MultiSelect = True. So I can use or key and...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.