日期:2014-05-18 浏览次数:20785 次
TreeNode curNode; private void treeView1_AfterSelect(object sender, TreeViewEventArgs e) { curNode = e.Node; this.textBox1.Text = e.Node.Text; } private void button1_Click(object sender, EventArgs e) { curNode.Text = this.textBox1.Text; }
------解决方案--------------------
js可以解决,麻烦些
------解决方案--------------------
private void treeView1_AfterSelect(object sender, TreeViewEventArgs e)
{
this.textBox1.Text = e.Node.Text;
}
在Button的Clieck事件中
if(this.treeView1.SelectedNode!=null)
{
if(this.textBox2.Text !=this.treeView1.SelectedNode.Text)
{
this.treeView1.SelectedNode.Text = this.textBox2.Text;
}
}
随便设置下TreeView的HideSelection =false;