如何判断两个textbox同时为空?
我试了一下,只有一个为空也提示信息。
  private void btnsave_Click(object sender, EventArgs e)
         {
            if (txt_jf.Text =="" && txt_df.Text =="" );
            {
            MessageBox.Show("借贷方不能同时为空!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
             txt_jf.Focus();
            }
         }
------解决方案--------------------if(string.IsNullOrEmpty(txt_jf.Text)&&string.IsNullOrEmpty(txt_df.Text))//这样
{
}
------解决方案--------------------如果.net 4.0:
if (!String.IsNullOrWhiteSpace(txt_jf.Text) && !String.IsNullOrWhiteSpace(txt_df.Text))
否则:
if (!String.IsNullOrEmpty(txt_jf.Text)  
   && txt_jf.Text.Trim() != ""  
   && !String.IsNullOrEmpty(txt_df.Text)
   && txt_df.Text.Trim() != "")