treeview to string?

  • Thread starter Thread starter gordon
  • Start date Start date
G

gordon

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
 
lblShow=tvSelection.SelectedNode.ToString();

You probably want

lblShow.Text = tvSelection.SelectedNode.Text;


Mattias
 
"gordon" <[email protected]> a écrit dans le message de [email protected]...

| 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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top