以文本方式查看主题

-  Foxtable(狐表)  (http://www.foxtable.com/bbs/index.asp)
--  专家坐堂  (http://www.foxtable.com/bbs/list.asp?boardid=2)
----  如何将焦点定位到导航中的满足条件的节点?  (http://www.foxtable.com/bbs/dispbbs.asp?boardid=2&id=28032)

--  作者:zpx_2012
--  发布时间:2013/1/16 20:04:00
--  如何将焦点定位到导航中的满足条件的节点?

各位老师,

 

保存时发现为空的必填字段,自动定位到为空的行,现在相实现如果左边导航窗口是关闭掉的,将导航窗口打开并自动定位到需要的节点并展开节点所在的目录树,

                              


此主题相关图片如下:360截图20130116195825519.jpg
按此在新窗口浏览图片

用了以下代码但,不起作用。

 

If Forms("导航").Opened = False Then
  Forms("导航").Open()
End If
Dim Bar As WinForm.NavBar = Forms("导航").Controls("NavBar1")
Bar.SelectedPage = Bar.NavPages("录入审批")
Dim tr As WinForm.TreeView = Forms("导航").Controls("TreeView3")
Dim nd As WinForm.TreeNode
For Each nd In tr.nodes
   If nd.name = MainTable.name Then
       nd.expand()
       For Each nd1 As WinForm.TreeNode In nd.nodes
         If nd1.name = e.DataRow("sys_流程") Then \'如果节点名称等于当前行的流程名。
             tr.SelectedNode = nd1
             Exit For
         End If
       Next
    Exit For
   End If
Next

 

要如何才能实现,谢谢!


--  作者:lin_hailun
--  发布时间:2013/1/16 21:03:00
--  
 楼主先用msgbox看看进到了那个循环里了,然后看看对应的值,先改一下。
--  作者:zpx_2012
--  发布时间:2013/1/16 21:53:00
--  

谢谢,原来treeview3中的目录树是动态生成的,将那些代码加在后面就可以了。