我是一个C#初学者,但似乎找不到任何关于这个问题的信息。这是我想做的事情:
string testString = txtBox1.Text;
string testString2 = txtBox2.Text;
if ((testString == "") || (testString2 == ""))
{
MessageBox.Show("You must enter a value into both boxes");
return;
}
基本上,我需要检查txtBox1或txtBox2是否为空。 但是在运行此代码时,我收到了一个错误。 我该如何正确地执行此操作(或者我的方法是错误的)?