采用bindinglist作为datagridview数据源可以增删行,但是datagridview cell中的数据无法编辑,Help me!

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
code:
private static BindingList<modelClass.element> elementsTree=new BindingList<modelClass.element>();<br/>
private static BindingList<modelClass.section> sectionsTree=new BindingList<modelClass.section>();

Program.ElementsTree.AllowEdit = true;<br/>
Program.ElementsTree.AllowNew = true;<br/>
Program.ElementsTree.AllowRemove = true;<br/>
//ElementsBinding.<br/>
dataGridView1.ReadOnly = false;<br/>
dataGridView1.DataSource = Program.ElementsTree;<br/>
dataGridView2.DataSource = Program.SectonsTree;
//when do this,the dataGridView displays data well, I can del & add a row, but I can not revise the data in the cell; Detail is:I input a new data in a cell, but the data change to the original data when I move the cursor to another cell, the cell
can not commit the new value, whats the problem?
//可以增删行,但是在我更改了一个单元格中的数据后,当把光标移动到其他单元格,数据又改回了原来的样子,新数据在单元格中不能提交,因此无法编辑单元格?请问是哪里出了问题?多多帮忙

View the full article
 
Back
Top