遍历GroupBox上的所有的textbox
foreach (Control c in groupBox1.Controls)
{
if (c is TextBox)
{
//这里写代码逻辑
}
}
遍历的时候,需要用Control遍历;
如果直接使用foreach(TextBox t in groupBox1.Controls)
并且groupbox上有Lable或其他非textbox控件的时候,会提示不能强制转换为textbox
所以,需要使用 is来判断,获取的控件是否为textbox
遍历GroupBox上的所有的textbox的更多相关文章
- asp.net中遍历界面上所有控件进行属性设置
* 使用方法: * 前台页面调用方法,重置: protected void Reset_Click(object sender, EventArgs e) { ...
- .Net遍历窗体上控件
实现遍历窗体上的控件以及找出TextBox控件,代码如下: foreach( Control control in this.Controls ) { if( control is TextBox ) ...
- NX二次开发-NXOPEN_DimensionCollection遍历图纸上的所有标注尺寸
NX11+VS2013 #include <NXOpen/Drawings_DrawingSheet.hxx> #include <NXOpen/Drawings_DrawingSh ...
- 遍历页面上所有TextBox,并赋值为String.Empty
//不含母板页 foreach (System.Web.UI.Control txtobj in this.Page.Controls) { if (txtobj.GetType().Na ...
- expect结合ssh遍历线上机器
有个需求,有个文件删除了,但是不确定线上机器还都存不存在 #!/home/work/.jumbo/bin/expect -f set timeout - set mac [lindex $argv ] ...
- Winform - 判断GroupBox控件中的TextBox文本框是不是为空
foreach (Control item in this.groupBox2.Controls) { if (item is TextBox) { if (item.Text.Trim() == & ...
- 遍历页面上主从表中从table中的内容
//如果在建VL的时候没有建访问器.从主表行拿到从表VO的行级不太好搞的 OAAdvancedTableBean innerTable = (OAAdvancedTableBean)webBean.f ...
- JEECMS-新闻内容中遍历批量上传的图片
[#list content.pictures as p] <li value="${p_index+1}"> <img src="${p.imgPat ...
- ts 遍历Class上的属性和方法
interface Type<T> extends Function { new (...args: any[]): T; } class Data { name = "ajan ...
随机推荐
- openssl配置
1.update openssl yum update openssl 2.修改openssl配置 vim /etc/ssh/sshd_config RSAAuthentication yesPubk ...
- Why String is Immutable or Final in Java
The string is Immutable in Java because String objects are cached in String pool. Since cached Strin ...
- 前端 HTML文档 详解
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...
- 【剑指offer】 二叉树中和为某一值的路径
一.题目: 输入一颗二叉树的跟节点和一个整数,打印出二叉树中结点值的和为输入整数的所有路径.路径定义为从树的根结点开始往下一直到叶结点所经过的结点形成一条路径.(注意: 在返回值的list中,数组长度 ...
- Unity 补充安装
当需要下载 安装Unity之时没勾选的一些组件时, 1.去Unity官网点开Unity旧版本 2.找到你的Unity版本,然后只要下载Unity安装程序 3.点开安装程序,去掉已安装组件的勾选,勾选你 ...
- Linux实验楼学习之一
查看当前所在目录 pwd 创建文件:1-1.txt touch 1-1.txt 进入统计目录下的etc目录 cd /etc 强行终止当前程序 Ctrl + c 常用快捷键 按键 作用 Ctrl+d 键 ...
- [LeetCode] 152. Maximum Product Subarray_Medium tag: Dynamic Programming
Given an integer array nums, find the contiguous subarray within an array (containing at least one n ...
- Kaggle案例泰坦尼克号问题
泰坦里克号预测生还人口问题 泰坦尼克号问题背景 - 就是那个大家都熟悉的『Jack and Rose』的故事,豪华游艇倒了,大家都惊恐逃生,可是救生艇#### 的数量有限,无法人人都有,副船长发话了l ...
- Oracal 11 g 数据库安装
一:下载安装包 http://www.oracle.com/technetwork/cn/database/enterprise-edition/downloads/112010-win64soft- ...
- Java jdbc 操作数据库详解
原文地址https://www.cnblogs.com/huguodong/p/5910859.html JDBC(Java Data Base Connectivity,java数据库连接)是一种用 ...