以文本方式查看主题 - Foxtable(狐表) (http://foxtable.com/bbs/index.asp) -- 专家坐堂 (http://foxtable.com/bbs/list.asp?boardid=2) ---- 控件标题 (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=188527) |
-- 作者:北狐 -- 发布时间:2023/9/25 14:18:00 -- 控件标题 For Each c As WinForm.Control In Forms("主界面").Controls If TypeOf c Is WinForm.Button Then If DataTables("授权表").Find("控件 =\'" & c.name & "\'") Is Nothing Then Dim nr As DataRow = DataTables("授权表").AddNew() nr("控件") = c.name nr("控件名称") = c.Text nr("窗体") = "主界面" End If End If Next 以下代码报错如下,无法正常取得控件的标题,老师帮忙看下原因 [此贴子已经被作者于2023/9/25 14:18:00编辑过]
|
-- 作者:有点蓝 -- 发布时间:2023/9/25 14:21:00 -- For Each c As WinForm.Control In Forms("主界面").Controls If TypeOf c Is WinForm.Button Then dim cc as WinForm.Button = c If DataTables("授权表").Find("控件 =\'" & cc.name & "\'") Is Nothing Then Dim nr As DataRow = DataTables("授权表").AddNew() nr("控件") = cc.name nr("控件名称") = cc.Text nr("窗体") = "主界面" End If End If Next
|
-- 作者:北狐 -- 发布时间:2023/9/25 15:18:00 -- 谢谢老师,要怎么取得控件所在的容器(TabControl)的名称和相应的页面名称 |
-- 作者:有点蓝 -- 发布时间:2023/9/25 15:46:00 -- Dim brn As WinForm.Button = Forms("窗口1").Controls("Button1") If brn.Parent IsNot Nothing Then MsgBox(brn.Parent.name) End If
|