tee*_*pee 0 c# textbox if-statement
我正在尝试制作一个if语句来检查是否TextBox有文本.
所以像这样:
if (textbox1 has text)
{
//Then do this..
}
Run Code Online (Sandbox Code Playgroud)
我怎么写"textbox1有文字"?
Ari*_*ian 24
if (textbox1.Text.Length > 0)
{
...
}
Run Code Online (Sandbox Code Playgroud)
要么
if (!string.IsNullOrEmpty(textbox1.Text))
{
...
}
Run Code Online (Sandbox Code Playgroud)