日期:2014-05-18  浏览次数:20732 次

气球状提示文本必须有非空的值。

准备期末考试。
我在做一个备忘录。

手动输入时间 和提示语言。

到时间以后右下角弹出图标提示并显示我之前输入的提示语言。

 if (timecheck())
  {
  notifyIcon1.BalloonTipText = textBox1.Text;
  notifyIcon1.BalloonTipTitle = "a new message!";
  this.notifyIcon1.ShowBalloonTip(3000);
  }

输入提示语言是在textbox里面输入。



运行以后就显示题目上的错误。
如果把textBox1.Text随便改一个字符串都是好用的。

谢谢 大家帮我看看哪里错啦。

------解决方案--------------------
C# code
 if (timecheck())
  {
  notifyIcon1.BalloonTipText =(textBox1.Text==string.Empty)?"对不起,无可奉告!": textBox1.Text;
  notifyIcon1.BalloonTipTitle = "a new message!";
  this.notifyIcon1.ShowBalloonTip(3000);
  }

------解决方案--------------------
notifyIcon1.BalloonTipText = textBox1.Text ?? "";

------解决方案--------------------
探讨

引用:

C# code
谢谢大侠 。解决了题目的问题。 出现了另一问题。 运行程序出现了“对不起,无可奉告。”