rant - vb.net treeview control nodeclick event missing?

G

Guest

I am upgrading from VB6 where I had access to a treeview NodeClick event
(see below)... but now VB.NET does not have this any more.

Private Sub TreeView1_NodeClick(ByVal Node As MSComctlLib.Node)
' VB6 code here.
End Sub

The VB.NET way seems to be inspect the SelectedNode property within the
TreeView's Click event... however this is extreamly buggy, and actually
fails under some very simple circumstances, telling me that one node is
selected, when in fact a different node is shown as selected. This is easily
reproducible behaviour, and I'll send the code if anyone's interested.

I find it hard to believe that Microsoft programmers STILL can't produce
good quality code (although I should not be surprised). It's like the
TreeView control is something they just can't fathom. We've had it for
years!!! You'd think it should actually get better - not worse!

I am using the Infragistics UltraTreeView control and although it does not
have a NodeClick event either, it's SelectedNode property seems to work as
expected. As a result, I am not going to use the Microsoft control.

Summary:

* Microsoft can't write TreeView controls.

* Microsoft can't write decent help files.
Not only does the help file contain utterly useless crap (and send you
around in circles) it is so SLOW on my Dual Pentium Processor (2.4GHz) that
it is quicker for me to look up information using Google, than it is to
interrogate my own Hard Drive. Is this progress my Microsoft? You decide.

* Did I mention the help file was useless? Oh yeah... sorry.

- Peter
 
C

Cor

Hi Spam,
I find it hard to believe that Microsoft programmers STILL can't produce
good quality code (although I should not be surprised).
I am using the Infragistics UltraTreeView control and although it does not
have a NodeClick event either, it's SelectedNode property seems to work as
expected.

You are not really able to tell if the SelectedNode property works in your
program as expected.

Are you sure that you have the the right to blame the Microsoft programmers?

Just my thought.

Cor
 
H

Herfried K. Wagner [MVP]

* "Spam Trap said:
Private Sub TreeView1_NodeClick(ByVal Node As MSComctlLib.Node)
' VB6 code here.
End Sub

The VB.NET way seems to be inspect the SelectedNode property within the
TreeView's Click event... however this is extreamly buggy, and actually
fails under some very simple circumstances, telling me that one node is
selected, when in fact a different node is shown as selected. This is easily
reproducible behaviour, and I'll send the code if anyone's interested.

Can you post some code to easily reproduce that behavior?
Not only does the help file contain utterly useless crap (and send you
around in circles) it is so SLOW on my Dual Pentium Processor (2.4GHz) that
it is quicker for me to look up information using Google, than it is to
interrogate my own Hard Drive. Is this progress my Microsoft? You decide.

Mhm... The MSDN Library runs very fast on my PII 350 MHz.

;->
 
G

Guest

Cor said:
Hi Spam,



You are not really able to tell if the SelectedNode property works in your
program as expected.

Are you sure that you have the the right to blame the Microsoft programmers?

Just my thought.

Cor

That's quite a bold statement yourself! How long have you been programming
with VB.any-version?

- Peter
 
S

scorpion53061

Mr.Spam,

How long ago Cor became a programmer is irrelevant to this discussion.

However if you must know Cor is an excellent programmer.

..AfterSelect may be something you want to look into.

Don't come back and insult anyone else. I have had my fill of it and my
tolerance is low.
 
B

Brian W

Maybe you should have spent a littl more time looking at teh help.

The example code shown at the topic for GetNodeAt(...) should be fool-proof.

HTH
Brian W
 
G

Guest

Herfried K. Wagner said:
Can you post some code to easily reproduce that behavior?
decide.

Mhm... The MSDN Library runs very fast on my PII 350 MHz.

;->

Steps to reproduce behaviour:

1) Create a form, place a treeview control on it.
2) Paste this code.

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Dim nodX As TreeNode
nodX = Me.TreeView1.Nodes.Add("Parent Node")
nodX.Nodes.Add("Child Node")
End Sub

Private Sub TreeView1_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles TreeView1.Click
MsgBox(Me.TreeView1.SelectedNode.Text)
End Sub

3) When you click on the parent, the correct node is displayed.
4) Expand the parent node (by clicking on the little plus symbol).
5) Click on the Child. Despite hilighting the child node (when the mouse
button is down), the "parent" is returned. Only after the "TreeView1_Click"
routine has completed, does the node get selected. I believe this makes the
Click event useless when used in conjuction with the SelectedNode property.

If you alternatly click each node, you will always get the wrong result
returned. Only clicking the node twice (not a double-click), will return the
expected result.

Now... is this just my computer doing this, or does anyone owe me an
apology?

- Peter
 
G

Guest

scorpion53061 said:
Peter,

Thanks for playing.

Go Away.

So you think the code I posted does not contain confusing behaviour or bugs?

It's convient that you want me to go away, the very instant I provide you
proof. That must make you feel uncomfortable since you were so willing to
leap to the defence of someone that insulted my ability to find a bug with
Microsoft's treeview control (specifically with the Click event and the
SelectedNode property). If it isn't an outright bug, then at the least it's
confusing behaviour that 3rd party vendors have not been keen to emulate.
IMHO, it's a bug.

- Peter
 
S

scorpion53061

It's convient that you want me to go away, the very instant I provide you

The issue is not the code.

The issue is your attitude.
That must make you feel uncomfortable since you were so willing to
leap to the defence of someone that insulted my ability

As I am familiar with Cor and his skills you bet I will defend him as I
would any regular on this board you chose to insult. Cor never meant to
insult you and I am sorry you took it that way.

People put time in here to help people and should not be treated
disrespectfully.

My suggestion is to lower the temperature of your rhetoric. It does not come
across well.

That being said, you are probably suffering from "IAmIronMan" (If you do not
know about this don't ask too long of a story) after effects at least with
me. Tolerance on this board right now for rudeness is at an all time low.

Lets just let this go and look at it another day when we are in better
moods. I may even volunteer to assist you in resolving this issue at that
point.
 
G

Guest

cool.

- Peter

scorpion53061 said:
The issue is not the code.

The issue is your attitude.


As I am familiar with Cor and his skills you bet I will defend him as I
would any regular on this board you chose to insult. Cor never meant to
insult you and I am sorry you took it that way.

People put time in here to help people and should not be treated
disrespectfully.

My suggestion is to lower the temperature of your rhetoric. It does not come
across well.

That being said, you are probably suffering from "IAmIronMan" (If you do not
know about this don't ask too long of a story) after effects at least with
me. Tolerance on this board right now for rudeness is at an all time low.

Lets just let this go and look at it another day when we are in better
moods. I may even volunteer to assist you in resolving this issue at that
point.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top