读书人

MessageBox.Show解决方案

发布时间: 2012-03-24 14:00:46 作者: rapoo

MessageBox.Show

C# code
    public partial class Form1 : Form    {        int i = 0;        public Form1()        {            InitializeComponent();        }        private void Form1_Load(object sender, EventArgs e)        {            timer1.Enabled = true;            timer1.Interval = 1000;        }        private void timer1_Tick(object sender, EventArgs e)        {            i++;            MessageBox.Show(i.ToString());            if (i >= 5)                timer1.Enabled = false;//timer停止        }    }

为什么它就停不掉?MessageBox.Show还有这功能?

[解决办法]

你自己看看你的代码,真是服了你了!

[解决办法]
探讨
C# code

private void timer1_Tick(object sender, EventArgs e)
{
i++;
MessageBox.Show(i.ToString()); //应该是i+1,然后打出来,然后再加1,然后再打,直到i=5,不是?
if (i >= 5) ……

读书人网 >.NET

热点推荐