How to programmatically edit a datagridview cell value in virtual mode?

I have a DataGridView in virtual mode. I just implemented the CellValueNeeded event handler, as described in http://msdn.microsoft.com/en-us/library/15a31akc.aspx .

The implementation of other events seems necessary only when you want to be able to edit cells manually.

I would like to programmatically change the value of a DataGridView cell.

I tried this using the following code:

DataGridView1.EditMode = DataGridViewEditMode.EditProgrammatically;
DataGridView1.BeginEdit(false);
DataGridView1.Rows[0].Cells[0].Value = "testing new value";
//just using a random parameter here, not sure it is needed when editing programmatically
DataGridView1.CommitEdit(DataGridViewDataErrorContexts.LeaveControl);
DataGridView1.Refresh();

but without success: (

any help would be appreciated

+3
source share
1 answer

, DataGridView . , , Refresh ( CellValueNeeded )

+7

Source: https://habr.com/ru/post/1719831/


All Articles