以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  [求助] tree控件未选择的情况下 怎么判断?  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=66768)

--  作者:jiskin
--  发布时间:2015/4/13 16:29:00
--  [求助] tree控件未选择的情况下 怎么判断?
Dim trv As WinForm.TreeView = e.Form.Controls("TreeView1")
If trv.SelectedNode IsNot Nothing And trv.SelectedNode.Level > 2  Then

当窗口打开后 直接点按钮控件的时候,这样判断会报错 该如何判断?

--  作者:Bin
--  发布时间:2015/4/13 16:39:00
--  
If trv.SelectedNode IsNot Nothing Then
  if trv.SelectedNode.Level > 2 then
  end if
end if

--  作者:jiskin
--  发布时间:2015/4/13 16:46:00
--  
以下是引用Bin在2015/4/13 16:39:00的发言:
If trv.SelectedNode IsNot Nothing Then
  if trv.SelectedNode.Level > 2 then
  end if
end if

 

OK