Hello sir,
I am having treeview control and webbrowser control.
I Having three nodes in treeview.
Node0 -> ParentNode
Node1 -> ChildNode
Node2 -> ChildNode
So when i click Node1, i want some webpage to be displayed in webbrowser control and similarly with node2.

Recommended Answers

All 6 Replies

Assume you've parent node and its child two nodes with text (www.microsoft.com and www.daniweb.com)
From treeview event handler, double click on NodeMouseClick

Private Sub treeView1_NodeMouseClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.TreeNodeMouseClickEventArgs) Handles treeView1.NodeMouseClick
        webBrowser1.Url = New Uri("http://" + e.Node.Text)
    End Sub

Not to mention you can use navigate method

webBrowser1.Navigate(e.Node.Text) 'without need to add "http://"

webBrowser1.Navigate(e.Node.Text)

I used the text property as this, but not working

Application.Startuppath & "\Source\main.html\"

But this code works with the form load event as

webbrowser1.navigate (Application.Startuppath & "\Source\main.html\")

I don't understand you, your question was to open web page in webbrowser control when selecting a node... I thought my code works, let me know what texts nodes hold?

I solved it, use file name in the tag with the extension and use the below coding

WebBrowser1.Navigate(Application.StartupPath & "\Source\" & e.Node.Tag)

I solved this, use file name in the tag with the extension and use the below coding

WebBrowser1.Navigate(Application.StartupPath & "\Source\" & e.Node.Tag)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.