C#定时(Timer)组件代码,添加了一个Timer控件,还有一个Label,如何运行?
privatevoidForm1_Load(objectsender,EventArgse){this.timer1.Interval=100;this.timer1.E...
private void Form1_Load(object sender, EventArgs e)
{
this.timer1.Interval = 100;
this.timer1.Enabled = true;
label1.Text = DateTime.Now.ToString();
String s = DateTime.Now.ToString();
int y = DateTime.Now.Year;
int m = DateTime.Now.Month;
int d = DateTime.Now.Day;
String s = DateTime.Now.DayOfWeek.ToString();
int h = DateTime.Now.Hour;
int m = DateTime.Now.Minute;
int s = DateTime.Now.Second;
System.DateTime moment = new System.DateTime(1999, 1, 13, 3, 57, 32, 11);
System.DateTime dTime = new System.DateTime (1980, 8, 5);
System.TimeSpan tSpan = new System.TimeSpan(17, 4, 2, 1);
System.DateTime result = dTime + tSpan;
}
还是报错那。
无法将类型“int”隐式转换为“string”
已在此范围定义了名为“m”的局部变量。
http://zhidao.baidu.com/question/458040958.html?quesup2 这是一起的。
可以帮我看一下么。远程也可以。谢谢、 展开
{
this.timer1.Interval = 100;
this.timer1.Enabled = true;
label1.Text = DateTime.Now.ToString();
String s = DateTime.Now.ToString();
int y = DateTime.Now.Year;
int m = DateTime.Now.Month;
int d = DateTime.Now.Day;
String s = DateTime.Now.DayOfWeek.ToString();
int h = DateTime.Now.Hour;
int m = DateTime.Now.Minute;
int s = DateTime.Now.Second;
System.DateTime moment = new System.DateTime(1999, 1, 13, 3, 57, 32, 11);
System.DateTime dTime = new System.DateTime (1980, 8, 5);
System.TimeSpan tSpan = new System.TimeSpan(17, 4, 2, 1);
System.DateTime result = dTime + tSpan;
}
还是报错那。
无法将类型“int”隐式转换为“string”
已在此范围定义了名为“m”的局部变量。
http://zhidao.baidu.com/question/458040958.html?quesup2 这是一起的。
可以帮我看一下么。远程也可以。谢谢、 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询