以编程方式为“组"框中的控件设置值 [英] Programatically setting values to controls within a Group box

查看:75
本文介绍了以编程方式为“组"框中的控件设置值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个包含表布局的组"框,其中有4列:其中2个仅包含复选框,另2个包含日期选择器.

I have a Group box containing a Table Layout, with 4 columns: 2 of them contain only checkboxes and the other 2 contain date pickers.

是否有一种方法可以添加一条命令,将所有复选框的值设置为True,将所有日期设置为Today,并通过它们进行循环? (无需引用每个控件的名称,因此,如果添加了复选框和日期选择器,则该代码仍然有效).确实 不必影响组"框或表格布局"之外的控件.

Is there a way to add a command that sets all the checkboxes value to True and all the dates to Today, cycling thru them? (without referring to each control's name, so if a checkbox and a datepicker are added, the code still works). It does not have to affect controls outside the Group box or Table Layout.

谢谢.

Nico.

推荐答案

您可以访问

GroupBox.Controls

属性,可为您提供该组框中的控件列表.如果要根据类型获取一组控件,请

property, which gives you a list of controls in that groupbox. If you want to get a set of controls based on type, go

var radiobuttons = GroubBox.Controls.OfType<RadioButton>();



这篇关于以编程方式为“组"框中的控件设置值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆