以文本方式查看主题 - Foxtable(狐表) (http://foxtable.com/bbs/index.asp) -- 专家坐堂 (http://foxtable.com/bbs/list.asp?boardid=2) ---- 通用多选目录树加载代码 (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=30165) |
-- 作者:cxabc123 -- 发布时间:2013/3/22 9:33:00 -- 通用多选目录树加载代码 把大家的成果集中在一起,发上来共享,以感谢各位的帮助知道。
Dim Lbs As String() ={"产品","客户","雇员","折扣","日期"} \'通用多选目录树加载代码.套用时只需修改本行. Dim trv As WinForm.TreeView = e.Sender Dim nd As WinForm.TreeNode = trv.SelectedNode Dim flt,s1 As String Dim n1 As Integer
For Each ndx As WinForm.TreeNode In nd.allNodes \'同步子节点选中状态 ndx.Checked = nd.Checked Next If nd.ParentNode IsNot Nothing Then \'确定父节点选中状态: For i As Integer = nd.ParentNode.level To 0 Step -1 \' Dim Inum As Integer = nd.ParentNode.Nodes.Count For Each ndc As WinForm.TreeNode In nd.ParentNode.Nodes If ndc.Checked Then Inum = Inum -1 End If Next If Inum = 0 Then nd.ParentNode.Checked = True nd = nd.ParentNode Else nd.ParentNode.Checked = False nd = nd.ParentNode End If Next End If For Each nd In trv.AllNodes If nd.Level > 0 AndAlso nd.ParentNode.Checked Then \'如果父节点选中 Continue For \'跳过此节点,处理下一结点 End If If nd.Checked AndAlso nd.FullPath IsNot Nothing Then n1=0 For Each s1 In nd.FullPath.split("\\") flt+ =iif(n1 =0,") Or (" ," and ") & Lbs(n1) & " = \'" & s1 & "\'" n1+=1 Next End If Next Application.DoEvents \'先勾选目录树,再加载数据. If flt IsNot Nothing Then Tables("订单").DataTable.LoadFilter = flt.Substring(4) & ")" Tables("订单").DataTable.Load() Else Tables("订单").DataTable.LoadFilter ="[_Identify] Is Null" Tables("订单").DataTable.Load() End If
|
-- 作者:everybody -- 发布时间:2013/5/25 12:07:00 -- 代码放在那里?窗口 afterload?提示错误哦
|
-- 作者:Bin -- 发布时间:2013/5/25 12:14:00 -- 请问你是要干什么呢?实现什么需求呢? 如果是 通用多选目录树 这个有例子可参照的啊.
|
-- 作者:everybody -- 发布时间:2013/5/25 12:19:00 -- 呵呵,正式想测试一下楼主到底出了什么好经验,通用多选目录树,这个帮助宝典都有了 |