关于treeview的问题
在一个窗体上只有 一个treeview控件
aaa
bbb
ccc
ddd
eee
fff
ggg
hhh
我想实现当我单击某个节点时在在窗体的右边显示我要的东西
(在窗体的右边有好多的 button)
我想了一个方法我认为可以呀
而且我认为没有错呀
怎么就是实现不了呢
If TreeView1.SelectedNode.Text = "aaa " Then ------
Button1.Visible = True
Button2.Visible = True
Button3.Visible = True
Button4.Visible = False
Button5.Visible = False
Button6.Visible = False
Button7.Visible = False
Button8.Visible = False
Button9.Visible = False
Button10.Visible = False
Button11.Visible = False
End If ========
If TreeView1.SelectedNode.Text = "bbb " Then ))))))
Button1.Visible = False
Button2.Visible = False
Button3.Visible = False
Button4.Visible = True
Button5.Visible = True
Button6.Visible = True
Button7.Visible = False
Button8.Visible = False
Button9.Visible = False
Button10.Visible = False
Button11.Visible = False
End If ((((((
If TreeView1.SelectedNode.Text = "eee " Then
Button1.Visible = False
Button2.Visible = False
Button3.Visible = False
Button4.Visible = False
Button5.Visible = False
Button6.Visible = False
Button7.Visible = False
Button8.Visible = True
Button9.Visible = True
Button10.Visible = True
Button11.Visible = True
End If
End Sub
TreeView1.SelectedNode.Text 不是获得我所选择的节点的值吗
又什么错吗
而且我设了段点
当我选择了aaa时候
从----到====都正常
但当我选择bbb时候
它跳过了第一个if语句这也对但是按理说它应该到下个if语句呀
(判断它是否的值是否等于bbb)
就是这里当段点到这里的时候它就从))))))到了(((((
中间的就没有执行
到底那里错了
在这先谢谢了
我只要思路不要代码
只要思路不要代码
只要思路不要代码
[解决办法]
在afterselect事件中
Button1.Visible = (e.Node.Text= "aaa ")
Button2.Visible = (e.Node.Text= "aaa ")
Button3.Visible = (e.Node.Text= "aaa ")
Button4.Visible = (e.Node.Text= "bbb ")
Button5.Visible = (e.Node.Text= "bbb ")
Button6.Visible = (e.Node.Text= "bbb ")
Button7.Visible = (e.Node.Text= "bbb ")
Button8.Visible = (e.Node.Text= "ccc ")
Button9.Visible = (e.Node.Text= "ccc ")
Button10.Visible = (e.Node.Text= "ccc ")
Button11.Visible = (e.Node.Text= "ccc ")