简体   繁体   中英

How to edit DataGridView on button Click

I have a DataGridView in which I am binding some records. I have a button Edit on my form. I want to Edit all the rows and column of the datagridview when I click on button Edit, so that user can change the data as per there need, and the data which is changed it should show in different color, so that user can recognizes that this data got changed.

till binding of grid I have done, how to edit and assign the color into changed cell I am unable to find solution.

Please something help me, with some exp. code. or some sugg.

There is already a property for that Enable Editing .

And after that you can apply formatting with the help of DataGridView.CellValueChanged Event

启用编辑

You can try with EditMode and ReadOnly

You set EditMode = DataGridViewEditMode.EditOnEnter .

You set ReadOnly to true for the cell, row, column, and control.

Link : http://msdn.microsoft.com/en-US/library/system.windows.forms.datagridview.editmode(v=vs.80 )

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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