简体   繁体   English

C#datagridview编辑控件

[英]C# datagridview editing control

I have an application that has a datagridview in it obviously enough, and I add data to it programatically like so: 我有一个应用程序中显然有一个datagridview,并且我以编程方式向其中添加数据,如下所示:

    dataGridView1.Rows.Add(string[]);

Before I add any objects to the dataGridView I can edit the cells by double clicking, hitting enter or f2. 在将任何对象添加到dataGridView之前,我可以通过双击,按Enter或f2来编辑单元格。 After data has been added into the rows however, I can no longer edit any of the values. 但是,将数据添加到行中之后,我将无法再编辑任何值。 I have tried toggling the "Read Only" attribute from true to false, and also tried to mess with: 我尝试将“只读”属性从true切换为false,并且还尝试弄乱:

    dataGridview1.EditMode ....

I don't know how to make the edit mode work properly, but on all previous keystrokes it just highlights the next row in the list. 我不知道如何使编辑模式正常工作,但是在所有先前的击键操作中,它仅突出显示列表中的下一行。

How can I enable the user to edit the data in the data grid view once the rows have been added ? 添加行后,如何使用户能够在数据网格视图中编辑数据?

Here are a list of tutorials on ways to accomplish this here: 这里是有关如何完成此操作的教程列表:

http://www.codeproject.com/Questions/433279/edit-delete-update-cancel-in-gridview-asp-net http://www.codeproject.com/Questions/433279/edit-delete-update-cancel-in-gridview-asp-net

I would start with these. 我将从这些开始。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM