Rss & SiteMap

Foxtable(狐表) http://www.foxtable.com

新一代数据库软件,完美融合Access、Foxpro、Excel、vb.net之优势,人人都能掌握的快速软件开发工具!
共11 条记录, 每页显示 10 条, 页签: [1] [2]
[浏览完整版]

标题:想分科目类别单独选择

1楼
zhuxinhui 发表于:2025/1/21 18:23:00
 DataTables("会计科目").loadtop = Nothing
        DataTables("会计科目").loadfilter = "科目类型='损益'"
        DataTables("会计科目").load()
        
       Dim tr As WinForm.TreeView = e.Form.Controls("TreeView1")
        Dim rts() As String = {"损益"} 
        Dim nd As WinForm.TreeNode
        Dim dt As DataTable = DataTables("会计科目")
        tr.StopRedraw()
        tr.Nodes.Clear
        Dim gz As String = "444"
        
        For Each rt As String In rts
图片点击可在新窗口打开查看此主题相关图片如下:微信截图_20250121182246.png
图片点击可在新窗口打开查看
            tr.Nodes.Add(rt)
        Next
        
        For Each dr As DataRow In dt.Select("", "科目编码")
            If dr.IsNull("科目编码") = False AndAlso dr("科目编码").Length = val(gz(0)) Then
                Dim i As Integer = CInt(dr("科目编码").Substring(0, 1))
                nd = tr.Nodes(i).Nodes.Add(dr("科目编码"), dr("科目编码") & " " & dr("科目名称"))
                Functions.Execute("km", nd, dt, gz, 1)
            End If
        Next
        tr.ResumeRedraw()
2楼
有点蓝 发表于:2025/1/21 20:04:00
没看懂什么意思
3楼
zhuxinhui 发表于:2025/1/22 9:14:00
删除目录树节点名称为:资产、负债、成本、损益,代码怎样写

4楼
zhuxinhui 发表于:2025/1/22 9:26:00
或者删除一、二级没有子节点的目录树节点
5楼
zhuxinhui 发表于:2025/1/22 9:29:00
我想使用下面的代码,先生成目录树,再删除一、二级没有节点的目录树节点。这样就可以做到我选择哪类科目就加载哪类
Dim tr As WinForm.TreeView = e.Form.Controls("TreeView1")
        Dim rts() As String = {"全部", "资产"} 
        Dim nd As WinForm.TreeNode
        Dim dt As DataTable = DataTables("会计科目")
        tr.StopRedraw()
        tr.Nodes.Clear
        Dim gz As String = "444"
        
        For Each rt As String In rts
            tr.Nodes.Add(rt)
        Next
        
        For Each dr As DataRow In dt.Select("", "科目编码")
            If dr.IsNull("科目编码") = False AndAlso dr("科目编码").Length = val(gz(0)) Then
                Dim i As Integer = CInt(dr("科目编码").Substring(0, 1))
                nd = tr.Nodes(i).Nodes.Add(dr("科目编码"), dr("科目编码") & " " & dr("科目名称"))
                Functions.Execute("km", nd, dt, gz, 1)
            End If
        Next
        tr.ResumeRedraw()
6楼
有点蓝 发表于:2025/1/22 10:09:00
放到最后

for i as integer = tr.Nodes.count - 1
if tr.Nodes(i).nodes.count = 0 then  tr.Nodes(i).delete
next
7楼
zhuxinhui 发表于:2025/1/22 11:18:00
语法错误
图片点击可在新窗口打开查看此主题相关图片如下:微信截图_20250122111605.png
图片点击可在新窗口打开查看
8楼
zhuxinhui 发表于:2025/1/22 11:26:00
DataTables("会计科目").loadtop = Nothing
        DataTables("会计科目").loadfilter = "科目类型='资产'"
        DataTables("会计科目").load()
        
        Dim tr As WinForm.TreeView = e.Form.Controls("TreeView1")
        Dim rts() As String = {"全部", "资产"} 
        Dim nd As WinForm.TreeNode
        Dim dt As DataTable = DataTables("会计科目")
        tr.StopRedraw()
        tr.Nodes.Clear
        Dim gz As String = "444"
        
        For Each rt As String In rts
            tr.Nodes.Add(rt)
        Next
        
        For Each dr As DataRow In dt.Select("", "科目编码")
            If dr.IsNull("科目编码") = False AndAlso dr("科目编码").Length = val(gz(0)) Then
                Dim i As Integer = CInt(dr("科目编码").Substring(0, 1))
                nd = tr.Nodes(i).Nodes.Add(dr("科目编码"), dr("科目编码") & " " & dr("科目名称"))
                Functions.Execute("km", nd, dt, gz, 1)
            End If
        Next
        tr.ResumeRedraw()

for i as integer = tr.Nodes.count - 1
if tr.Nodes(i).nodes.count = 0 then  tr.Nodes(i).delete
next
9楼
有点蓝 发表于:2025/1/22 11:27:00
很简单的错误,自己思考一下:http://www.foxtable.com/webhelp/topics/0225.htm
10楼
zhuxinhui 发表于:2025/1/22 15:51:00
for i as integer = 0 TO tr.Nodes.count - 1
if tr.Nodes(i).nodes.count = 0 then  tr.Nodes(i).delete
next
此主题相关图片如下:微信截图_20250122154701.png
按此在新窗口浏览图片
共11 条记录, 每页显示 10 条, 页签: [1] [2]

Copyright © 2000 - 2018 foxtable.com Tel: 4000-810-820 粤ICP备11091905号

Powered By Dvbbs Version 8.3.0
Processed in .03516 s, 2 queries.