Foxtable(狐表)用户栏目专家坐堂 → 遍历控件的问题


  共有2354人关注过本帖树形打印复制链接

主题:遍历控件的问题

帅哥哟,离线,有人找我吗?
akkio99
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:幼狐 帖子:66 积分:680 威望:0 精华:0 注册:2018/2/2 1:05:00
遍历控件的问题  发帖心情 Post By:2020/3/10 17:58:00 [只看该作者]

With Tables("数据表")

 
If .Current IsNot Nothing And .Current.locked=True Then
 .Current.Locked = False

 For Each c As WinForm.Control In e.Form.Controls("Panel1")
    If Typeof c Is WinForm.TextBox Then '判断控件是否是文本框
       Dim t As WinForm.TextBox = c '使用特定类型的变量引用控件
               t.BackColor = color.white

    ElseIf  Typeof c Is WinForm.Datetimepicker Then '判断控件是否是文本框
        Dim da As winform.Datetimepicker=c
        da.BackColor = color.white

End If
Next

End If

End With

 

大神,请问为什么不能遍历某个控件中的控件呢? 有什么解决办法吗?

[此贴子已经被作者于2020/3/10 17:58:26编辑过]

 回到顶部
帅哥哟,离线,有人找我吗?
akkio99
  2楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:幼狐 帖子:66 积分:680 威望:0 精华:0 注册:2018/2/2 1:05:00
  发帖心情 Post By:2020/3/10 18:01:00 [只看该作者]

.NET Framework 版本:4.0.30319.36543
Foxtable 版本:2019.10.26.1
错误所在事件:窗口,收费录入,Button8,Click
详细错误信息:
无法将类型为“Foxtable.WinForm.Panel”的对象强制转换为类型“System.Collections.IEnumerable”。

 回到顶部
帅哥哟,离线,有人找我吗?
有点蓝
  3楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:超级版主 帖子:107880 积分:548763 威望:0 精华:9 注册:2015/6/24 9:21:00
  发帖心情 Post By:2020/3/10 20:20:00 [只看该作者]

For Each c As WinForm.Control In e.Form.Controls("Panel1").Children

 回到顶部