Hack Forums
[.NET] Using A TreeView With A WebBrowser - Printable Version

+- Hack Forums (https://hackforums.net)
+-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444)
+--- Forum: Coding (https://hackforums.net/forumdisplay.php?fid=151)
+---- Forum: Software Development (https://hackforums.net/forumdisplay.php?fid=118)
+---- Thread: [.NET] Using A TreeView With A WebBrowser (/showthread.php?tid=801822)



Using A TreeView With A WebBrowser - Pulser - Nov 7, 2010

Tree View


Okay, so recently I have been seeing a lot of webbrowsers being posted. Now, that is all fine and dandy, but hey! It gets a little old. This is a tutorial on how to implement a Tree View.

[IMG]http://i55.[censored].com/zm12wx.gif[/IMG]

This tutorial is going to be a little different. I am going to do it all on a GIF and explain it step by step.
Spoiler (Click to View)

- Create a TreeView Control.
- Create a New WebBrowser Control.
- Go to the mouse click event of the treeview nodes.
- Insert:

Code
TreeNode site = e.Node; // New TreeNode. e.Node = clicked node
string url = string.Empty;
url = (string)site.Tag; // Accesses the tag that we setup "http://www.Google.com
webBrowser1.Navigate(url); // Navigates the browser

I hope this aims people toward being more creative in their browsers!

Code
private void treeView1_NodeMouseClick(object sender, TreeNodeMouseClickEventArgs e)
  {
    TreeNode site = e.Node; // Sets up a new tree node object
    string url = string.Empty; // a new string variable
    url = (string)site.Tag;  

    webBrowser1.Navigate(url); // navigates to the tag we setup earlier

    // Be sure to have it in the mouse click event
  }



* - Łost - Nov 7, 2010

Interesting. You could kind of incorporate this into web browsers that are looking for a Bookmarking system.


* - Pulser - Nov 7, 2010

(Nov 7, 2010 02:31 PM)LostDesigns Wrote:  Interesting. You could kind of incorporate this into web browsers that are looking for a Bookmarking system.

Yup, you could implement this into anything really.


* - Coder - Nov 7, 2010

Nice. Now get their favicon and display as icon in treeview instead of + and -, that would look neat. :)


* - Pulser - Nov 8, 2010

(Nov 7, 2010 10:02 PM)Coder Wrote:  Nice. Now get their favicon and display as icon in treeview instead of + and -, that would look neat. :)

Yeah, Ill implement some things later.


* - ⚖️ Lollipop ⚖️ - Nov 8, 2010

Damn fucking [censored] craped on your images o.o Change the image hosting.


* - Pulser - Nov 8, 2010

(Nov 8, 2010 01:34 PM)Pedo Bear Wrote:  Damn fucking [censored] craped on your images o.o Change the image hosting.

i updated it. sorry! 🤣🤣


* - ident - Nov 8, 2010

One of my favorite controls..

short