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. (Last updated on : Nov 16th 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Show form when node is clicked vb.net

Thread ID:

Created:

Updated:

Platform:

Replies:

119402 Jun 16,2015 07:21 PM UTC Jun 17,2015 08:25 AM UTC WinForms 2
loading
Tags: TreeViewAdv
Toby Hutton
Asked On June 16, 2015 07:21 PM UTC


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 07:37 PM UTC


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 08:25 AM UTC

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.

Warning Icon 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.Close Icon

;