TreeView -Click Event on Plus Sign Node 
Author Message
 TreeView -Click Event on Plus Sign Node

Hi,

I want to know, how to read the Node when the user click on the plus
sign, I did some research on it but no luck, Got any Idea?

Regards,
Sudhakar



Tue, 19 Apr 2005 07:45:55 GMT  
 TreeView -Click Event on Plus Sign Node
hi

The link below provides online samples of using the .NET Treeview control in
VB.NET.

ms-help://MS.VSCC/MS.MSDNVS/Cpqstart/html/cpsmpnetsamples-windowsformscontro
lreference.htm#cpsmptreeviewcontrolsample

chitra vb community

--
This posting is provided "AS IS" with no warranties, and confers no rights.


Quote:
> Hi,

> I want to know, how to read the Node when the user click on the plus
> sign, I did some research on it but no luck, Got any Idea?

> Regards,
> Sudhakar



Wed, 20 Apr 2005 04:26:24 GMT  
 TreeView -Click Event on Plus Sign Node
It took me over an hour to download, install this SDK.. Long time for a
simple answer.

The quick answer is that the expanded node is

e.Node

in the beforeExpand or afterExpand events

-Bill Gates



Quote:
> hi

> The link below provides online samples of using the .NET Treeview control
in
> VB.NET.

ms-help://MS.VSCC/MS.MSDNVS/Cpqstart/html/cpsmpnetsamples-windowsformscontro
Quote:
> lreference.htm#cpsmptreeviewcontrolsample

> chitra vb community

> --
> This posting is provided "AS IS" with no warranties, and confers no
rights.


> > Hi,

> > I want to know, how to read the Node when the user click on the plus
> > sign, I did some research on it but no luck, Got any Idea?

> > Regards,
> > Sudhakar



Mon, 25 Apr 2005 06:49:04 GMT  
 TreeView -Click Event on Plus Sign Node
To expand a bit on this:

Paste the following code routines into a vb form
Inside the Treeview1_Click event:

On Error Resume Next

MessageBox.Show(TreeView1.SelectedNode.Text.ToString())

Inside the Treeview1_AfterSelect event

On Error Resume Next

MessageBox.Show(TreeView1.SelectedNode.Text.ToString(), "After Selected")

in the Form load:

Dim node As System.Windows.Forms.TreeNode

Dim SubNode As System.Windows.Forms.TreeNode

node = TreeView1.Nodes.Add("The Main Node")

SubNode = node.Nodes.Add("Subnode1")

SubNode.Nodes.Add("Under the Subnode1")

SubNode = node.Nodes.Add("Subnode2")

SubNode.Nodes.Add("Under the Subnode2")

If you run this code, you will find that the node that is highlighted is the
node which gets returned when you click the + sign.

Also notice that when you click on a subnode -- moving the focus to the node
you clicked, the click event will tell you where you were before navigating
through the treeview nodes.

This occurs because the control hasn't gotten the opportunity to reposition
perior to the click event being fired..

The messagebox will reflect this.

I thought this to be important because sometimes its good to know where the
user was in the tree  and this provides you with the opportunity to track
the previously selected node,

if you need to.

HTH


Quote:
> It took me over an hour to download, install this SDK.. Long time for a
> simple answer.

> The quick answer is that the expanded node is

> e.Node

> in the beforeExpand or afterExpand events

> -Bill Gates



> > hi

> > The link below provides online samples of using the .NET Treeview
control
> in
> > VB.NET.

ms-help://MS.VSCC/MS.MSDNVS/Cpqstart/html/cpsmpnetsamples-windowsformscontro

- Show quoted text -

Quote:
> > lreference.htm#cpsmptreeviewcontrolsample

> > chitra vb community

> > --
> > This posting is provided "AS IS" with no warranties, and confers no
> rights.


> > > Hi,

> > > I want to know, how to read the Node when the user click on the plus
> > > sign, I did some research on it but no luck, Got any Idea?

> > > Regards,
> > > Sudhakar



Mon, 25 Apr 2005 07:24:51 GMT  
 TreeView -Click Event on Plus Sign Node
Richard,

Thanks for the sample code, it works fine, the main node got selected
at the time of form load,
In my case I have too many node sub node, sub sub node and so on..
don't want to creat all of them at once, so added the (+) plus sign to
represent the node which is having the sub node without adding real
sub nodes (just by adding single dummy node), what I wanted now is,
when the user clicks on the (+) plus sign, I want read the node,
delete the dummy node before user see this dummy node, which was
created to add the + sign and generate the real sub nodes.

I appreciate your help or tips in this issue.

Thanks,
Sudhakar



Sun, 08 May 2005 05:06:19 GMT  
 TreeView -Click Event on Plus Sign Node
Public Class Form1
    Inherits System.Windows.Forms.Form

#Region " Windows Form Designer generated code "

    Public Sub New()
        MyBase.New()

        'This call is required by the Windows Form Designer.
        InitializeComponent()

        'Add any initialization after the InitializeComponent() call

    End Sub

    'Form overrides dispose to clean up the component list.
    Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
        If disposing Then
            If Not (components Is Nothing) Then
                components.Dispose()
            End If
        End If
        MyBase.Dispose(disposing)
    End Sub

    'Required by the Windows Form Designer
    Private components As System.ComponentModel.IContainer

    'NOTE: The following procedure is required by the Windows Form Designer
    'It can be modified using the Windows Form Designer.
    'Do not modify it using the code editor.
    Friend WithEvents TreeView1 As System.Windows.Forms.TreeView
    Friend WithEvents Button1 As System.Windows.Forms.Button
    <System.Diagnostics.De{*filter*}StepThrough()> Private Sub
InitializeComponent()
        Me.TreeView1 = New System.Windows.Forms.TreeView()
        Me.Button1 = New System.Windows.Forms.Button()
        Me.SuspendLayout()
        '
        'TreeView1
        '
        Me.TreeView1.ImageIndex = -1
        Me.TreeView1.Location = New System.Drawing.Point(40, 16)
        Me.TreeView1.Name = "TreeView1"
        Me.TreeView1.SelectedImageIndex = -1
        Me.TreeView1.Size = New System.Drawing.Size(360, 456)
        Me.TreeView1.TabIndex = 0
        '
        'Button1
        '
        Me.Button1.Location = New System.Drawing.Point(464, 32)
        Me.Button1.Name = "Button1"
        Me.Button1.Size = New System.Drawing.Size(112, 32)
        Me.Button1.TabIndex = 1
        Me.Button1.Text = "Button1"
        '
        'Form1
        '
        Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
        Me.ClientSize = New System.Drawing.Size(744, 518)
        Me.Controls.AddRange(New System.Windows.Forms.Control() {Me.Button1,
Me.TreeView1})
        Me.Name = "Form1"
        Me.Text = "Form1"
        Me.ResumeLayout(False)

    End Sub

#End Region

    Private Sub TreeView1_AfterSelect(ByVal sender As System.Object, ByVal e
As System.Windows.Forms.TreeViewEventArgs) Handles TreeView1.AfterSelect

    End Sub

    Private Sub TreeView1_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles TreeView1.Click
        TreeView1.Cursor = System.Windows.Forms.Cursors.Hand
        TreeView1.Cursor.Show()

    End Sub

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

    Private Sub TreeView1_BeforeExpand(ByVal sender As Object, ByVal e As
System.Windows.Forms.TreeViewCancelEventArgs) Handles TreeView1.BeforeExpand
        Dim Node As TreeNode
        Dim Node1 As TreeNode
        Node = TreeView1.SelectedNode
        Node.Nodes.Remove(TreeView1.SelectedNode.Nodes(0))
        Node.Text = "Hello"
        Node.Nodes.Add("World")
    End Sub
End Class

HTH



Quote:
> Richard,

> Thanks for the sample code, it works fine, the main node got selected
> at the time of form load,
> In my case I have too many node sub node, sub sub node and so on..
> don't want to creat all of them at once, so added the (+) plus sign to
> represent the node which is having the sub node without adding real
> sub nodes (just by adding single dummy node), what I wanted now is,
> when the user clicks on the (+) plus sign, I want read the node,
> delete the dummy node before user see this dummy node, which was
> created to add the + sign and generate the real sub nodes.

> I appreciate your help or tips in this issue.

> Thanks,
> Sudhakar



Sun, 08 May 2005 07:01:22 GMT  
 TreeView -Click Event on Plus Sign Node
Richard,

It works like a champ! Thank you so much,

Sudhakar



Mon, 09 May 2005 05:44:45 GMT  
 
 [ 7 post ] 

 Relevant Pages 

1. No node click event in Windows.Forms.TreeView?

2. Treeview: highlight node with control Click event

3. Treeview node Click event?

4. TreeView node double-click event?

5. Treeview Plus (+) sign

6. plus/minus sign (treeview control)

7. TreeView Plus Signs

8. plus/minus sign (treeview control)

9. TreeView with plus/minus-signs?

10. TreeView 'Plus Signs'

11. Treeview Plus (+) sign

12. Treeview Plus (+) sign

 

 
Powered by phpBB® Forum Software