---
title: "How to use TreeView Control and WebBrowser Control in CSharp .NET"  
description: "/* Style Definitions */   table.MsoNormalTable  	{mso-style-name:\"Table Normal\";  	mso-tstyle-rowband-size:0;  	mso-tstyle-colband-size:0;  	mso-st"  
author: "Anonymous User"  
published: 2010-08-02  
updated: 2020-03-04  
canonical: https://www.mindstick.com/articles/79/how-to-use-treeview-control-and-webbrowser-control-in-csharp-dot-net  
category: "c#"  
tags: ["c#"]  
reading_time: 2 minutes  

---

# How to use TreeView Control and WebBrowser Control in CSharp .NET

TreeViews have plus symbols that we can click. To add one to our form find tree view control on tool box and use it in your form.

![How to use TreeView Control and WebBrowser Control in CSharp .NET](https://www.mindstick.com/mindstickarticle/34fd2e9f-4cc4-4524-9907-7ccdaaae20f9/images/7378f050-8f9a-4155-92f1-ba6fe1cc4372.png)

Now, to add Nodes to the TreeView, click the TreeView to select it. Then locate the Nodes property in the properties area

![How to use TreeView Control and WebBrowser Control in CSharp .NET](https://www.mindstick.com/mindstickarticle/34fd2e9f-4cc4-4524-9907-7ccdaaae20f9/images/c14b742a-9a27-49d0-be93-7c08150a8e49.png)

Click the button with the three dots in it, just to the right of Collection. You'll then see the TreeNode Editor Dialogue box.

![How to use TreeView Control and WebBrowser Control in CSharp .NET](https://www.mindstick.com/mindstickarticle/34fd2e9f-4cc4-4524-9907-7ccdaaae20f9/images/58884843-987a-46d6-9a09-c4a0e0e5d2a3.png)

There are two types of Nodes you can Add - a Root Node and a Child Node. Click the **Add Root** button.

Set the following properties:

**Name**: Google\
**Tag**: http://www.google.com\
**Text**: Google

**Name**: Yahoo\
**Tag**: http://www.yahoo.com\
**Text**: Yahoo!

**Name**: Bing\
**Tag**: http://www.bing.com\
**Text**: Bing

![How to use TreeView Control and WebBrowser Control in CSharp .NET](https://www.mindstick.com/mindstickarticle/34fd2e9f-4cc4-4524-9907-7ccdaaae20f9/images/68167428-f925-4152-aa0c-50a0596543ef.png)

Now, add a webBrowser to the form.

![How to use TreeView Control and WebBrowser Control in CSharp .NET](https://www.mindstick.com/mindstickarticle/34fd2e9f-4cc4-4524-9907-7ccdaaae20f9/images/7998cfb3-78c8-4534-b9fe-216faf378597.png)

Now write the code for TreeView control’s at NodeMouseClick Event.

```
private void treeView1_NodeMouseClick(object sender, TreeNodeMouseClickEventArgs e)        {            TreeNode nName = e.Node;             string webPage = "";            webPage = (string)nName.Tag;//seting webPage to node tag string.            if (webPage != "")            {                webBrowser1.Navigate(webPage); //Navigating to webPage address.            }        }   
```

![How to use TreeView Control and WebBrowser Control in CSharp .NET](https://www.mindstick.com/mindstickarticle/34fd2e9f-4cc4-4524-9907-7ccdaaae20f9/images/b0e8cf51-e8ce-417b-b37a-9befcb87a1e9.png)

![How to use TreeView Control and WebBrowser Control in CSharp .NET](https://www.mindstick.com/mindstickarticle/34fd2e9f-4cc4-4524-9907-7ccdaaae20f9/images/206094f6-dc30-4f27-93a4-e36843706582.png)

\

---

Original Source: https://www.mindstick.com/articles/79/how-to-use-treeview-control-and-webbrowser-control-in-csharp-dot-net

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
