471,354 Members | 1,191 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

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

treeview to string?

Hi

I am trying to get the selection from a tree view with a child node to be
written to the value of a label.

I am using...

private void btnShow_Click(object sender, System.EventArgs e)

{

lblShow=tvSelection.SelectedNode.ToString();

}

but am getting an error - Cannot implicitly convert type 'string' to
System.Windows.Forms.Label

the treeview has two parents and several child nodes (all at the immediate
child level).

thanks

Dec 3 '05 #1
2 4836
>lblShow=tvSelection.SelectedNode.ToString();

You probably want

lblShow.Text = tvSelection.SelectedNode.Text;
Mattias

--
Mattias Sjögren [C# MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.
Dec 3 '05 #2
"gordon" <go**********@optusnet.com.au> a écrit dans le message de news:
43***********************@news.optusnet.com.au...

| private void btnShow_Click(object sender, System.EventArgs e)
| {
| lblShow=tvSelection.SelectedNode.ToString();
| }
|
| but am getting an error - Cannot implicitly convert type 'string' to
| System.Windows.Forms.Label

You are trying to assign a string to the label rather than the label's Text
property.

Joanna

--
Joanna Carter [TeamB]
Consultant Software Engineer
Dec 3 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

42 posts views Thread by lauren quantrell | last post: by
5 posts views Thread by Mark Goldin | last post: by
4 posts views Thread by Ian Powell | last post: by
reply views Thread by DKode | last post: by
13 posts views Thread by André Nogueira | last post: by
6 posts views Thread by L.M | last post: by
6 posts views Thread by cyriel1920 | last post: by
6 posts views Thread by xla76 | last post: by
reply views Thread by XIAOLAOHU | last post: by

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.