473,385 Members | 2,180 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Multiline treeview possible?

DS
Can anyone think of a way or point me in the right direction to be able to
get a multiline treeview? By this I mean that each TreeNode Label can span
say 2 lines (delimited by \n)?

Thanks!
-Dan
Nov 16 '05 #1
4 6391
DS

"DS" <no****************@rogers.com> wrote in message
news:hd********************@rogers.com...
Can anyone think of a way or point me in the right direction to be able to
get a multiline treeview? By this I mean that each TreeNode Label can span
say 2 lines (delimited by \n)?


Just to clarify with a bit of an example:
+ John Doe
Widgets Inc.
-Home Contact
-Work Contact
+ Jane Doe
SomeCo.
-Headoffice Contact
-International Contact

In this case treeNode1.Text = "John Doe\nWidgets Inc.", with 2 child nodes
beneath it; treeNode2.Text = "Jane Doe\nSomeCo.", also with 2 child nodes.
Make sense?

Thanks :-)
Nov 16 '05 #2
DS
> "DS" <no****************@rogers.com> wrote in message
news:hd********************@rogers.com...
Can anyone think of a way or point me in the right direction to be able
to get a multiline treeview? By this I mean that each TreeNode Label can
span say 2 lines (delimited by \n)?


Just to clarify with a bit of an example:
+ John Doe
Widgets Inc.
-Home Contact
-Work Contact
+ Jane Doe
SomeCo.
-Headoffice Contact
-International Contact

In this case treeNode1.Text = "John Doe\nWidgets Inc.", with 2 child nodes
beneath it; treeNode2.Text = "Jane Doe\nSomeCo.", also with 2 child nodes.
Make sense?


Hey guys, I posted this message a few days ago and got no response.. I'm
hoping that someone has at least played with this or can give me some
advice.

Thanks again,
Dan
Nov 16 '05 #3
"DS" wrote:
"DS" <no****************@rogers.com> wrote in message
news:hd********************@rogers.com...
Can anyone think of a way or point me in the right direction to be able
to get a multiline treeview? By this I mean that each TreeNode Label can
span say 2 lines (delimited by \n)?


Just to clarify with a bit of an example:
+ John Doe
Widgets Inc.
-Home Contact
-Work Contact
+ Jane Doe
SomeCo.
-Headoffice Contact
-International Contact

In this case treeNode1.Text = "John Doe\nWidgets Inc.", with 2 child nodes
beneath it; treeNode2.Text = "Jane Doe\nSomeCo.", also with 2 child nodes.
Make sense?


Hey guys, I posted this message a few days ago and got no response.. I'm
hoping that someone has at least played with this or can give me some
advice.

Thanks again,
Dan


Hi Dan!

I want to show you an example. I haven't checked for errors, but can give
you an Idea. Hope it helps.

Best Regard
Hans

//---------------------------------------------
private TreeView trvContact = new TreeView();

private string [] RootArray = new string [2];
private string [] Child1Array = new string [2];
private string [] Child2Array = new string [2];

private void initialize_ArrayList ()
{
this.RootArray[0] = "John Doe\nWidgets Inc";
this.RootArray[1] = "Jane Doe\nSomeCo.";

this.Child1Array[0] = "Home Contact";
this.Child1Array[1] = "Work Contact";

this.Child2Array[0] = "HeadOffice Contact";
this.Child2Array[1] = "International Contact";
}//initialize_ArrayList

private void initialize_TreeView ()
{
//locate TreeView
this.trvContact.Location = new point (0,0); //upper left corner
this.trvContact.Size = new Size (200, 400); //width and hight
this.Controls.Add (this.trvContact);

//Add parent to tree
for (int p = 0; p < this.RootArray.Length; p++)
{
TreeNode ChildNode = new TreeNode(RootArray[p].ToString());
ChildNode.Tag = p //a suitable number
this.trvContant.Nodes.Add (ChildNode);
}//for RootArray

//Add ChildNode 1 to ParentNode 2
for (int p = 0; p < this.Child1Array.Length; p++)
{
TreeNode ChildNode = new TreeNode(this.Child1Array[p].ToString());
ChildNode.Tag = 100 + p //a suitable number
this.trvContant.Nodes[0].Nodes.Add (ChildNode);
}// for Child1Array

//Add ChildNode 2 to ParentNode 2
for (int p = 0; p < this.Child2Array.Length; p++)
{
TreeNode ChildNode = new TreeNode(this.Child2Array[p].ToString());
ChildNode.Tag = 200 + p //or a suitable number
this.trvContant.Nodes[1].Nodes.Add (ChildNode);
}// for Child1Array
}//initialize_TreeView

private void Form1_Load (object sender, System.EventArgs e)
{
this.initialize_ArrayList ();
this.initialize_TreeView ();
}
//------------------------------------------------------
Nov 16 '05 #4
DS

"Hans [DiaGraphIT]" <Ha************@discussions.microsoft.com> wrote in
message news:F9**********************************@microsof t.com...
"DS" wrote:
> "DS" <no****************@rogers.com> wrote in message
> news:hd********************@rogers.com...
>> Can anyone think of a way or point me in the right direction to be
>> able
>> to get a multiline treeview? By this I mean that each TreeNode Label
>> can
>> span say 2 lines (delimited by \n)?
>
> Just to clarify with a bit of an example:
> + John Doe
> Widgets Inc.
> -Home Contact
> -Work Contact
> + Jane Doe
> SomeCo.
> -Headoffice Contact
> -International Contact
>
> In this case treeNode1.Text = "John Doe\nWidgets Inc.", with 2 child
> nodes
> beneath it; treeNode2.Text = "Jane Doe\nSomeCo.", also with 2 child
> nodes.
> Make sense?
>


Hey guys, I posted this message a few days ago and got no response.. I'm
hoping that someone has at least played with this or can give me some
advice.

Thanks again,
Dan


Hi Dan!

I want to show you an example. I haven't checked for errors, but can give
you an Idea. Hope it helps.

Best Regard
Hans

<code snipped>


Hi Hans,
Thanks for the reponse, but thats similar to what I tried before (that being
using a '\n' in the treeNode.Text field). What you end up with is a []
looking character (one of the weird unicode boxes) and everything still on a
single line (except for the child nodes of course being a level deeper). Any
other ideas? Is there perhaps a way for me to easily inherit the
functionality of the treeview into a control of my own and just rewrite the
way it renders text? I have no clue where to even begin with this approach,
so any help would certainly be appreciated!

Cheers,
Dan
Nov 16 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Rasmus Fogh | last post by:
Dear All, I need a way of writing strings or arbitrary Python code that will a) allow the strings to be read again unchanged (like repr) b) write multiline strings as multiline strings instead...
13
by: Yatima | last post by:
Hey Folks, I've got some info in a bunch of files that kind of looks like so: Gibberish 53 MoreGarbage 12 RelevantInfo1 10/10/04
2
by: Sandy | last post by:
Is there some way to incorporate paging with a treeview, or are there some new controls out there that would be capable of this sort of thing? Can a treeview be put in a datagrid? If so, how?...
10
by: p3t3r | last post by:
I have a treeview sourced from a SiteMap. I want to use 2 different CSS styles for the root level nodes. The topmost root node should not have a top border, all the other root nodes should have a...
2
by: Tymbow | last post by:
I'm building a web application that is analogous to the Windows XP file explorer in function. The left column contains a TreeView, and the right column a DataGrid populated by selecting TreeView...
0
by: Mrin | last post by:
Hi group, I am in strong and urgent requirement of a control with multiline Listview with treeview control. Expecting any kind of help in this regard. Thanks, Mrin
2
by: Lakesider | last post by:
Hi NG, I want to use a List Control, that is able to display the following szenario: Customer A New York Revenue: 1200,- € Customer B
1
by: watsod1 | last post by:
Hello, This is my first post, Hello to all. This also a test post to make sure that I am doing the right thing and following rules etc. I have been searching for a way to make the treeview...
2
by: Mike | last post by:
I am trying to write a little program for my own use using VB2005 express edition. I have a list of peoples names in a file that I read into an array of strings. I am using a multiline textbox to...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.