C#判断多个文本框是否为空的方法
作者:乱码人生 时间:2022-05-12 23:05:32
本文实例讲述了C#判断多个文本框是否为空的方法。分享给大家供大家参考。具体实现方法如下:
/// <summary>
/// 自定义方法,判断项目中txt标签是否为空
/// </summary>
/// <param name="txt">要进行判断为空的标签</param>
/// <returns>是否全部都不为空,如果全部都不为空返回 true </returns>
bool CheckEmpty(params TextBox[] txt)
{
bool flag = true;
for (int i = 0; i < txt.Length; i++)
{
if (txt[i].Text.Trim() == "")
{
MessageBox.Show("标记为 * 的选项不能为空,请重新输入!");
txt[i].Focus();
flag = false;
break;
}
}
return flag;
}
希望本文所述对大家的C#程序设计有所帮助。
标签:C#,判断,文本框
![](/images/zang.png)
![](/images/jiucuo.png)
猜你喜欢
C#实现骑士飞行棋
2022-01-13 18:50:29
![](https://img.aspxhome.com/file/2023/3/78193_0s.jpg)
dubbo入门指南及demo实例详解
2023-08-24 04:49:07
![](https://img.aspxhome.com/file/2023/6/67166_0s.jpg)
解决Android Studio电脑不支持HAXM的问题
2022-05-28 04:48:51
![](https://img.aspxhome.com/file/2023/4/108314_0s.jpg)
android实现蓝牙app代码
2021-07-08 07:52:15
解决java读取EXCEL数据变成科学计数法的问题
2023-06-14 02:17:56
![](https://img.aspxhome.com/file/2023/5/83675_0s.png)
一文告诉你为什么要重写hashCode()方法和equals()方法
2021-09-05 07:05:55
Spring Boot 单元测试JUnit的实践
2023-08-29 02:02:15
![](https://img.aspxhome.com/file/2023/7/91127_0s.png)
详解Spring与Mybatis整合方法(基于IDEA中的Maven整合)
2023-11-06 21:35:12
![](https://img.aspxhome.com/file/2023/0/58690_0s.png)
Unity Shader实现序列帧动画效果
2021-10-31 22:50:18
![](https://img.aspxhome.com/file/2023/5/77225_0s.png)
java 实现KMP算法
2022-09-14 15:44:40
![](https://img.aspxhome.com/file/2023/4/83104_0s.gif)
C#预处理指令之#line,#pragma warning 详细解析
2021-05-26 22:09:06
![](https://img.aspxhome.com/file/2023/6/70416_0s.jpg)
java代码实现C盘文件统计工具
2021-06-23 01:22:38
![](https://img.aspxhome.com/file/2023/4/67664_0s.png)
详解C#如何实现分割视频
2022-12-07 10:48:23
![](https://img.aspxhome.com/file/2023/7/85707_0s.png)
.NET实现父窗体关闭而不影响子窗体的方法
2022-10-06 20:56:04
![](https://img.aspxhome.com/file/2023/4/104264_0s.jpg)
Java URL自定义私有网络协议
2021-08-11 02:21:06
![](https://img.aspxhome.com/file/2023/1/85871_0s.png)
Java lambda表达式与泛型整理总结
2021-07-15 19:57:14
c# BackgroundWorker使用方法
2021-05-27 00:49:12
![](https://img.aspxhome.com/file/2023/1/76411_0s.png)
java多线程读取多个文件的方法
2022-12-05 04:37:45
C#9.0新特性详解——顶级程序语句(Top-Level Programs)
2023-07-05 18:46:03
![](https://img.aspxhome.com/file/2023/6/106406_0s.jpg)
C#发送邮箱实现代码
2022-04-16 11:57:57