准备期末考试。
我在做一个备忘录。手动输入时间 和提示语言。到时间以后右下角弹出图标提示并显示我之前输入的提示语言。 if (timecheck())
            {
                notifyIcon1.BalloonTipText = textBox1.Text;
                notifyIcon1.BalloonTipTitle = "a new message!";
                this.notifyIcon1.ShowBalloonTip(3000);
            }输入提示语言是在textbox里面输入。运行以后就显示题目上的错误。
如果把textBox1.Text随便改一个字符串都是好用的。谢谢 大家帮我看看哪里错啦。

解决方案 »

  1.   

     public string nowtime() 
            {
                string firsttime = DateTime.Now.ToShortDateString();
                string secondtime = DateTime.Now.ToShortTimeString().ToString();
                string nowtimereturn = firsttime + " " + secondtime;
                return nowtimereturn;
            }        public bool timecheck() 
            {
                string nowtime_computer = nowtime() + "";
                StreamReader readtext = new StreamReader(@"c:\timedata.txt");
                bool result = false;
                while (!readtext.EndOfStream) 
                {
                    string nowtime_customer = readtext.ReadLine() + "";
                    try
                    {
                        if (nowtime_customer.Remove(8) == nowtime_computer.Remove(8))
                        {
                            result = true;
                            message = nowtime_customer;
                        }
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show(ex.ToString());
                    }
                    finally { }
                }
                readtext.Close();
                return result;
                    
            }
      

  2.   

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

  3.   

    notifyIcon1.BalloonTipText = textBox1.Text ?? "";
      

  4.   


    谢谢大侠 。解决了题目的问题。 出现了另一问题。 运行程序出现了“对不起,无可奉告。”
    我在textbox里输入的值,我想要到时间才弹出。
    现在变成了,我在textbox里输入字符串以后直接就显示了。嗷嗷  感谢感谢  大侠再帮我看看吧。
      

  5.   

    你的这个到时间才弹出 是怎么个到法?
    用Timer控件吧  你是不是刚开始学程序
      

  6.   


    timer 我能不写么 乖乖。
    我没贴出来 。
    表示本人是大三滴,而且就是本学期有C#课要考试。= =。以后我想走java方向 。虽然我java也不怎么样。
      

  7.   

     if (timecheck())
      {
      notifyIcon1.BalloonTipText = textBox1.Text;
      notifyIcon1.BalloonTipTitle = "a new message!";
      this.notifyIcon1.ShowBalloonTip(3000);
      } private void timer1_Tick(object sender, EventArgs e){} 里的。