简体   繁体   English

每次我按下按钮时,我希望它指示 C# 中我的文本框或文本框何时为空

[英]Evertime I press a button I want it to indicate when my textbox or textboxes are empty in C#

Evertime I press a button I want it to indicate when my textbox or textboxes are empty.每当我按下一个按钮时,我希望它指示我的文本框或文本框何时为空。 Because there's 3 and I need this error to come up even when one out of all is empty.因为有 3 个,即使其中一个为空,我也需要出现此错误。 If all textboxes are filled up I want my progress bar to start loading too.如果所有文本框都已填满,我希望我的进度条也开始加载。 I'd really appreciate your help!我真的很感谢你的帮助!

create keydown event for all textboxes same, and call the function为所有文本框创建相同的 keydown 事件,并调用 function

public void checkstatus()
{
if(textbox1.Text.Trim()=="" || textbox2.Text.Trim()=="" || textbox3.Text.Trim()=="")
{
 MessageBox.Show("Some Textboxes are empty");
}
else
{
 progessbar.Start();
}

} }

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 C# 如何在文本框为空时防止按 Tab 键 - C# how do I prevent tab key press when textbox is empty 当我第二次按下按钮时,如果 C# 中的语句使文本框恢复正常 - if statements in C# for a textbox to change back to normal when i press a button for the second time 按下按钮时如何创建所需数量的对象实例?c#winforms - How do I create as many instances of an object as i want when a button is press c# winforms 当我按(*)如何在TextBox中获取(。)(在C#WinCE中) - when i press (*) how to get (.) in TextBox (in C# WinCE) 当我按 Backspace 时,C# 向 TextBox 输入一个 ASCII 字符 - C# inputs an ASCII character to the TextBox when I press Backspace 按下文本框中的Enter键时按钮触发 - Button firing when I press enter in a textbox c#如何检查一个文本框中是否已存在对象? 如果是,则不要将其添加到文本框中 - c# How do i check if an object is already in one of my textboxes? if it is then dont add it to a textbox 我想让表单上的所有文本框都接受仅包含尽可能少的代码的数字-C# - I want make all textboxes on my form to accept only numbers with as little code as possible - c# 我希望当我按Enter按钮然后确定按钮工作时 - I want that when I press Enter Button then ok button work 我在gridview中有3个文本框。 当输入值到第一个和第二个文本框时,我想自动将结果写入第三个文本框 - i have 3 textboxes in gridview. When value is entered to first and second textboxes i want automatically write result to third textbox
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM