以文本方式查看主题 - Foxtable(狐表) (http://foxtable.com/bbs/index.asp) -- 专家坐堂 (http://foxtable.com/bbs/list.asp?boardid=2) ---- 目录录入问题 (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=188774) |
|
-- 作者:lin98 -- 发布时间:2023/10/18 10:29:00 -- 目录录入问题 如何实现目录选中赋值给表A的指定列?如图 下面代码如何改 本节的内容可以参考CaseStudy目录下的文件:多选目录树.Table 实现方法很简单: 1、新建一个窗口,名为“窗口1”,窗口类型设置为“DropDownForm”。 2、窗口中插入一个TreeView(目录树)控件和一个Button(按钮),TreeView的"显示复选框"属性设置为True。 3、窗口的DropDownOpened事件设置为: Dim s As String = e.Form.DropDownBox.Value 上述代码的目的在于每次打开下拉窗口的时候,都能自动勾选已经输入的项目。 4、确定按钮的代码设置为: Dim s As String 5、最后将项目事件AfterOpenProject的代码设置为: [此贴子已经被作者于2023/10/18 10:30:45编辑过]
|
|
-- 作者:有点蓝 -- 发布时间:2023/10/18 10:39:00 -- Dim s As String Dim trv As WinForm.TreeView = e.Form.Controls("TreeView1") For Each nd As WinForm.TreeNode In trv.AllNodes If nd.level = 1 andalso nd.Checked Then e.Form.DropDownBox.Value = nd.Text for each a as WinForm.TreeNode In nd.AllNodes If nd.Checked Then s = s & "," & a.Text End If next
tables("表A").current("第二列") = s exit for End If Next e.Form.DropDownBox.CloseDropdown |
|
-- 作者:lin98 -- 发布时间:2023/10/18 14:17:00 -- 问题一:选中出错,下面执行全部选,如何实现1楼图,选中“电脑配件”下面分类都被选中? Dim trv As WinForm.TreeView = e.Form.Controls("TreeView1") For Each r As WinForm.TreeNode In trv.AllNodes If e.Node.Level = 0 Then \'如果是顶层节点 Return \'则返回 End If r.Checked = True Next 问题二:目录树选中,如何录入表的指定字段? For Each r As Row In Tables("表A").GetCheckedRows Dim trv2 As WinForm.TreeView = e.Form.Controls("TreeView1") For Each nd As WinForm.TreeNode In trv2.AllNodes Dim nma() As String = {"次类", "子类"} \'A Dim nmb() As String = {"次类", "子类"} \' Dim dr As Row = Tables("产品表").AddNew \' For i As Integer = 0 To nma.Length - 1 dr(nmb(i)) = r(nma(i)) Next Next
|
|
-- 作者:有点蓝 -- 发布时间:2023/10/18 14:22:00 -- 1、AfterCheckNode事件 For Each cnd As WinForm.TreeNode In e.Node.Nodes \'取消子节点的选中标记,因为选中父节点,就不要选中子节点了 cnd.Checked = False Next 2、参考2楼用法
|
|
-- 作者:lin98 -- 发布时间:2023/10/18 15:12:00 --
|
|
-- 作者:有点蓝 -- 发布时间:2023/10/18 15:17:00 -- cnd.Checked = e.Node.Checked |
|
-- 作者:lin98 -- 发布时间:2023/10/18 15:37:00 -- 参考2楼,报错,执行不了 .NET Framework 版本:4.0.30319.42000 Foxtable 版本:2022.8.18.1 错误所在事件:窗口,窗口2,Button2,Click 详细错误信息: 未将对象引用设置到对象的实例。 Dim s As String Dim s2 As String Dim trv As WinForm.TreeView = e.Form.Controls("TreeView1") For Each nd As WinForm.TreeNode In trv.AllNodes If nd.level = 1 AndAlso nd.Checked Then e.Form.DropDownBox.Value = nd.Text For Each a As WinForm.TreeNode In nd.AllNodes If nd.Checked Then s = s & "," & a.Text s2 = s2 & "," & a.Text End If Next Tables("产品表").current("品种") = s Tables("产品表").current("品名") = s2 Exit For End If Next \'e.Form.DropDownBox.CloseDropdown |
|
-- 作者:有点蓝 -- 发布时间:2023/10/18 15:56:00 -- …… For Each nd As WinForm.TreeNode In trv.AllNodes If nd.level = 1 AndAlso nd.Checked Then Tables("产品表").current("品种") = nd.Text For Each a As WinForm.TreeNode In nd.Nodes If a.Checked Then s2 = s2 & "," & a.Text End If Next Tables("产品表").current("品名") = s2 Exit For End If Next |
|
-- 作者:lin98 -- 发布时间:2023/10/18 16:47:00 -- 老师,内容要分行,如何实现? |
|
-- 作者:有点蓝 -- 发布时间:2023/10/18 16:54:00 -- 在第2个for循环里新增行,然后赋值 |