为什么不弹框。
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;namespace WindowsFormsApplication1
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }        DateTime nineTime = DateTime.Parse("2010-12-30 17:30:00");
        private void timer1_Tick(object sender, EventArgs e)
        {
            if (DateTime.Now.TimeOfDay.CompareTo(nineTime.TimeOfDay) == 0)
            {
                ShowMessage();
            }
        }        private void ShowMessage()
        {
            MessageBox.Show("下班了!");
        }
    }
}

解决方案 »

  1.   

    看你的Timer Enabled是否为True,Interval间隔是多少?
      

  2.   


    if (DateTime.Now.Subtract(nineTime).Second>0)
    {
        ShowMessage();
    }
      

  3.   

    你的nineTime.TimeOfDay得到的只有时分秒,而DateTime.Now.TimeOfDay获取的有毫秒,永远也匹配不了吧
      

  4.   

    代码不论写的对与错,Interval没有设置,貌似定时器的TICKER时间不会触发吧,况且也没有看见是否Enable属性设置为TRUE。
      

  5.   

    public Form1()
            {
                InitializeComponent();
    timer1.Start();
            }