364,033 Members | 4804 Browsing Online
Community for Developers & IT Professionals
Bytes IT Community

TreeView inside a ListView

mylixes
P: 29
How could I include a treeView inside a ListView?
Feb 7 '12 #1
Share this Question
Share on Google+
4 Replies


GaryTexmo
Expert 100+
P: 1,225
I'm not sure if you can do that with any built in .NET controls. You might want to look at using a custom control. I'm not entirely sure of what functionality you're looking for, but if it's the grid presentation with treeview functionality, the following article may be of use to you.

http://blogs.msdn.com/b/markrideout/...08/510700.aspx

I used this on a project in the past and with fairly minimal enhancement it worked quite well for me :)
Feb 7 '12 #2

Gobi nath
P: 16
use treeview control on toolbox ,it will suit for u
Feb 9 '12 #3

mylixes
P: 29
Thanks Gary for the reply. the link you shared helps me a lot. but I had encountered another problem using the expandable datagridView.

My datagrid consists of 4 columns, string column (treeView), combobox, linklabel and string column. Below is my code.

Expand|Select|Wrap|Line Numbers
  1. foreach (KeyValuePair<int, string[]> name in nameDictionary)
  2.             {
  3.                 parentNameNode = helper.getName(name.Value[i]);
  4.  
  5.                 //treeView1.Font = new Font(null, FontStyle.Bold);
  6.                 parentNode = rootNode.Nodes.Add(parentNameNode);
  7.                 parentNode.DefaultCellStyle.Font = new Font("Verdana", 7, FontStyle.Bold);
  8.  
  9.                 if (name.Value.Length > 1)
  10.                 {
  11.  
  12.                     for (int a = 0; a < name.Value.Length; a++)
  13.                     {
  14.  
  15.                         childNode = parentNode.Nodes.Add(readerName.Value[a], "aaaa", "Start");
  16.                         childNode.DefaultCellStyle.Font = new Font("Verdana", 7, FontStyle.Regular);
  17.  
  18.  
  19.                     }
  20.                 }
  21.  
Question:

How could I populate the comboBox column? I am getting this error "DataGridViewComboBoxCell value is not valid".

Please help me.
Mar 7 '12 #4

LittleDong
P: 10

Question:

How could I populate the comboBox column? I am getting this error "DataGridViewComboBoxCell value is not valid".

Please help me.
comboBox.Items.Add(yourItemshere)
is this useful?
Mar 7 '12 #5

Post your reply

Help answer this question



Didn't find the answer to your C# / C Sharp question?

You can also browse similar questions: C# / C Sharp