C#BindingList只读错误 [英] c# BindingList read-only error

查看:171
本文介绍了C#BindingList只读错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在尝试寻找问题的可能原因,但似乎找不到:

I keep trying to look for the possible cause of the problem but I cant seem to find it:

错误:


System.NotSupportedException:集合为只读。在
处System.ThrowHelper.ThrowNotSupportedException(ExceptionResource
资源)在System.Collections.ObjectModel.Collection`1.Add(T
item)在
WindowsFormsApplication1.Form1.Btn_CSVSEATINGPLAN_Click(Object发送者,
EventArgs e),位于C:\Users\aRJiJon\Documents\Visual Studio
2010\Projects\WindowsFormsApplication_1\WindowsFormsApplication1\Form1.cs:line
72

System.NotSupportedException: Collection is read-only. at System.ThrowHelper.ThrowNotSupportedException(ExceptionResource resource) at System.Collections.ObjectModel.Collection`1.Add(T item) at WindowsFormsApplication1.Form1.Btn_CSVSEATINGPLAN_Click(Object sender, EventArgs e) in C:\Users\aRJiJon\Documents\Visual Studio 2010\Projects\WindowsFormsApplication_1\WindowsFormsApplication1\Form1.cs:line 72



            this.dataGridView1.DefaultCellStyle.Font = new Font("Tahoma", 11);
            bindingCSVSP.DataSource = CSV_Seating_Plan;
            bindingCSVSP.AllowNew = true;

CSV_Seating_Plan.AllowNew = true;
CSV_Seating_Plan.AllowRemove = true;
CSV_Seating_Plan.RaiseListChangedEvents = true;
CSV_Seating_Plan.AllowEdit = true;
this.dataGridView1.DataSource = bindingCSVSP;
this.btn_Process_SP.Enabled = true;
CSV_Seating_Plan.Add(new csv_SeatingPlan());

public string examperiod;
[FieldConverter(ConverterKind.Date, "dd/mm/yyyy")]
public DateTime date_Exam;
public string time;
public string exam_Code;
public string id_Student;
public string name_Student;
public string candidatenum_Student;
public string seat_num;
public string _WSS_EXEC;
public string exam_loc;


#region getsetmethods.
public string EXAMPERIOD
{ get { return this.examperiod; } }
public DateTime DATE_TIME
{ get { return this.date_Exam; } }
public string TIME
{ get { return this.time; } }
public string EXAM_CODE
{ get { return this.exam_Code; } }
public string ID_STUDENT
{ get { return this.id_Student; } }
public string NAME_STUDENT
{ get { return this.name_Student; } }
public string CANDIDATE_NUMBER
{ get { return this.candidatenum_Student; } }
public string SEAT_NUM
{ get { return this.seat_num; } }
public string WSS_EXEC
{ get { return this._WSS_EXEC; } }
public string EXAM_LOC
{ get { return this.exam_loc; } }
#endregion

public csv_SeatingPlan()
{
}

有人可以告诉我我缺少什么吗?

Can anyone tell me what I'm missing?

推荐答案

这意味着基础实现IList为您的通用集合类为IsReadOnly属性返回true。

This means that the underlying implementation of IList for you generic collection class is returning true for the IsReadOnly property.

这篇关于C#BindingList只读错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆