Microsoft KB Archive/240229

= BUG: Treeview Control NodeClick Event Not Raised When SingleSel = True =

Article ID: 240229

Article Last Modified on 10/15/2002

-

APPLIES TO


 * Microsoft Visual Basic 6.0 Professional Edition
 * Microsoft Visual Basic 6.0 Enterprise Edition
 * Microsoft Visual Studio 6.0 Service Pack 3

-



This article was previously published under Q240229



SYMPTOMS
After setting the SingleSel property of the Treeview control to True, the NodeClick event for this control is not always raised. This only occurs with the version of Mscomctl.ocx that is included in Visual Basic 6.0 Service Pack 3.



STATUS
Microsoft has confirmed that this is a problem in Visual Basic 6.0 Service Pack 3.



Steps to Reproduce Behavior
 Confirm that Visual Basic 6.0 Service Pack 3 installed. Start a new Visual Basic Standard EXE project. Form1 is created by default. From the Project menu select Components. In the Components dialog box, select "Microsoft Windows Common Controls 6.0 (SP3)", and then click OK. Add a Treeview control to Form1.  Add the following code to the General Declarations section of Form1: Private Sub Form_Load Dim nodx As Node ' Declare Node variable.

TreeView1.SingleSel = True

' Add Node objects. Set nodx = TreeView1.Nodes.Add(,, "r", "Root1")

Set nodx = TreeView1.Nodes.Add("r", tvwChild, "child1a", "Child1") Set nodx = TreeView1.Nodes.Add("r", tvwChild, "child1b", "Child2")

Set nodx = TreeView1.Nodes.Add(, tvwChild, "r2", "Root2")

Set nodx = TreeView1.Nodes.Add("r2", tvwChild, "child2a", "Child1") Set nodx = TreeView1.Nodes.Add("r2", tvwChild, "child2b", "Child2") Set nodx = TreeView1.Nodes.Add("r2", tvwChild, "child2c", "Child3")

Set nodx = TreeView1.Nodes.Add(, tvwChild, "r3", "Root3")

Set nodx = TreeView1.Nodes.Add("r3", tvwChild, "child3a", "Child1") Set nodx = TreeView1.Nodes.Add("r3", tvwChild, "child3b", "Child2") Set nodx = TreeView1.Nodes.Add(, tvwChild, "r4", "Root4") End Sub

Private Sub TreeView1_NodeClick(ByVal Node As MSComctlLib.Node) MsgBox Node.Text End Sub  Run the project. Root1 will be selected. Click on Root2. No message box displays, indicating that the NodeClick event was not raised.</li></ol>

Keywords: kbbug kbtreeview kbcmnctrls kbprb kbpending kbactivexevents KB240229

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.