We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

Show form when node is clicked vb.net

Thread ID:

Created:

Updated:

Platform:

Replies:

119402 Jun 16,2015 03:21 PM Jun 17,2015 04:25 AM Windows Forms 2
loading
Tags: TreeViewAdv
Toby Hutton
Asked On June 16, 2015 03:21 PM


Hi

Could someone advise me on how to open a windows form when a child is clicked, i've been trying to work it out without success.

Thanks


Toby Hutton
Replied On June 16, 2015 03:37 PM


Just sorted it, Re-tweaked a bit of code. For those that a interested be see below, I have included both C# and VB

VB

Private Sub TreeView1_AfterSelect(ByVal sender As Object, ByVal e As EventArgs) Handles TreeView1.AfterSelect
        Dim tn As TreeNodeAdv = Me.TreeView1.SelectedNode
        Select Case tn.Text
            Case "About"
                AboutForm.Show()
            Case Else
                MessageBox.Show("This node does not have a form associated with it.")
        End Select
    End Sub

C#

private void TreeView1_AfterSelect(object sender, EventArgs e)
{
	TreeNodeAdv tn = this.TreeView1.SelectedNode;
	switch (tn.Text) {
		case "About":
			AboutForm.Show();
			break;
		default:
			MessageBox.Show("This node does not have a form associated with it.");
			break;
	}
}

Ashwini Jaya Preetha Durai Samy [Syncfusion]
Replied On June 17, 2015 04:25 AM

Hi Toby,

Thank you for using Syncfusion products.

We are glad to hear that your requirement has been achieved. It can also be done by using the NodeMouseClick event as in the below code snippet.

Code snippet[ C#]:


  // Loading Form using NodesMouseClick event

        void treeViewAdv1_NodeMouseClick(object sender, Syncfusion.Windows.Forms.Tools.TreeViewAdvMouseClickEventArgs e)

        {

            Form2 form2 = new Form2();      

            if(e.Node.Text=="ChildNode")

                form2.Show();
        }


Code snippet [VB]:


' Loading Form using NodesMouseClick event

              Private Sub treeViewAdv1_NodeMouseClick(ByVal sender As Object, ByVal e As Syncfusion.Windows.Forms.Tools.TreeViewAdvMouseClickEventArgs)

                     Dim form2 As New Form2()

                     If e.Node.Text="ChildNode" Then

                           form2.Show()

                     End If
              End Sub


Sample Location: http://www.syncfusion.com/downloads/support/forum/119402/ze/TreeViewAdvFormLoadSample1324049284

Please let us know if you need any further assistance,

Regards,
Ashwini

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;