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;namespace WindowsFormsApplication3
{
public partial class Form1 : Form
{
public Form1()
{
int a = this.monthCalendar1.SelectionEnd.Year;
int b = this.monthCalendar1.SelectionEnd.Month;
int c = this.monthCalendar1.SelectionEnd.Day;
this.textBox1.Text=a.ToString(); }
}
}
用以上代码获取年,月,日的时候,总是会提示未将对象引用设置到对象的实例,不知道 是何原因。
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;namespace WindowsFormsApplication3
{
public partial class Form1 : Form
{
public Form1()
{
int a = this.monthCalendar1.SelectionEnd.Year;
int b = this.monthCalendar1.SelectionEnd.Month;
int c = this.monthCalendar1.SelectionEnd.Day;
this.textBox1.Text=a.ToString(); }
}
}
用以上代码获取年,月,日的时候,总是会提示未将对象引用设置到对象的实例,不知道 是何原因。
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货