C# 未将对象引用设置到对象的实例
privatevoidForm1_Load(objectsender,EventArgse){bindingSource1.Clear();bindingSource1....
private void Form1_Load(object sender, EventArgs e) {
bindingSource1.Clear();
bindingSource1.Add(new Info());
}
private void button1_Click(object sender, EventArgs e) {
Info info = bindingSource1.Current as Info;
List<Info> list = this.MyGV.DataSource as List<Info>;
list.Add(info);//这句报的错
this.MyGV.DataSource = new List<Info>();
this.MyGV.DataSource = list;
} 展开
bindingSource1.Clear();
bindingSource1.Add(new Info());
}
private void button1_Click(object sender, EventArgs e) {
Info info = bindingSource1.Current as Info;
List<Info> list = this.MyGV.DataSource as List<Info>;
list.Add(info);//这句报的错
this.MyGV.DataSource = new List<Info>();
this.MyGV.DataSource = list;
} 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询