首页上一页 1 下一页尾页 1 条记录 1/1页
c#编程问题
发表在C#图书答疑
2012-08-04
是否精华
是
否
版块置顶:
是
否
请问一下老师下面这段代码为什么显示错误
private void Form1_Load(object sender, EventArgs e)
{
int a = Convert .ToInt16 (textBox1 .Text );
timer1.Interval = a;
timer1.Enabled = true;
}
完整代码为
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Microsoft.VisualBasic;
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
int a = Convert .ToInt16 (textBox1 .Text );
timer1.Interval = a;
timer1.Enabled = true;
}
private void timer1_Tick(object sender, EventArgs e)
{
Form2 f2=new Form2 ();
f2.Show();
}
private void button1_Click(object sender, EventArgs e)
{
this.Close();
}
private void button2_Click(object sender, EventArgs e)
{
if (textBox1.Text == "")
{
MessageBox.Show("请输入时间!");
}
else
{
timer1.Start();
}
}
}
}