How to set cell value of datagridview on cell double click?
-
Hello Friends, I am not able to set the cell value of datagridview on cell double click. here is the code on cell double click : GV.Rows(e.RowIndex).Cells(e.ColumnIndex).ReadOnly = False GV.Rows(e.RowIndex).Cells(e.ColumnIndex).value = "TEST" It is giving System.Data.ReadOnlyException. Thanks & Regards, Rahul
rahul saini
-
Hello Friends, I am not able to set the cell value of datagridview on cell double click. here is the code on cell double click : GV.Rows(e.RowIndex).Cells(e.ColumnIndex).ReadOnly = False GV.Rows(e.RowIndex).Cells(e.ColumnIndex).value = "TEST" It is giving System.Data.ReadOnlyException. Thanks & Regards, Rahul
rahul saini
What is the
DataSource
for theDataGridView
? What is the full error message?Henry Minute Do not read medical books! You could die of a misprint. - Mark Twain Girl: (staring) "Why do you need an icy cucumber?" “I want to report a fraud. The government is lying to us all.”
-
What is the
DataSource
for theDataGridView
? What is the full error message?Henry Minute Do not read medical books! You could die of a misprint. - Mark Twain Girl: (staring) "Why do you need an icy cucumber?" “I want to report a fraud. The government is lying to us all.”
Hello Henry, I am using DataGridView and bind it with DataTable. Error Description: DataGridView column bound to a read-only field must have ReadOnly set to True. above error comes on this statement: GV.Columns(e.ColumnIndex).ReadOnly = False ==================other error:============ this error occur on : GV.Rows(e.RowIndex).Cells(e.ColumnIndex).ReadOnly = False GV.Rows(e.RowIndex).Cells(e.ColumnIndex).Value = "text" DataGridView Default Error Dialog The following exceptions occurred in the DataGridView System.Data.ReadOnlyException: Column 'Status' is Read only at System.Data.Datarow.set_Item(DataColumn column, Object value) at System.Data.DatarowView.SetColumnValue(DataColumn Column, Object value) at System.Data.DataColumnPropertyDescriptor.SetValue(Object Component, Object value) at System.Windows.Forms.DataGridView.DataGridViewDataConnection.PushValue(Int32BoundColumnIndex, Int32 columnIndex, Int32 rowIndex, Object value) To replace this default dialog please handle the DataError event Regards Rahul
rahul saini
-
Hello Henry, I am using DataGridView and bind it with DataTable. Error Description: DataGridView column bound to a read-only field must have ReadOnly set to True. above error comes on this statement: GV.Columns(e.ColumnIndex).ReadOnly = False ==================other error:============ this error occur on : GV.Rows(e.RowIndex).Cells(e.ColumnIndex).ReadOnly = False GV.Rows(e.RowIndex).Cells(e.ColumnIndex).Value = "text" DataGridView Default Error Dialog The following exceptions occurred in the DataGridView System.Data.ReadOnlyException: Column 'Status' is Read only at System.Data.Datarow.set_Item(DataColumn column, Object value) at System.Data.DatarowView.SetColumnValue(DataColumn Column, Object value) at System.Data.DataColumnPropertyDescriptor.SetValue(Object Component, Object value) at System.Windows.Forms.DataGridView.DataGridViewDataConnection.PushValue(Int32BoundColumnIndex, Int32 columnIndex, Int32 rowIndex, Object value) To replace this default dialog please handle the DataError event Regards Rahul
rahul saini
then clearly the problem is that the column in the
DataTable
is readonly, so presumably it is in the underlying database. Trying to change theReadOnly
property in yourDataGridView
cannot possibly alter this. You have to investigate, and find out why the underlying data is readonly.DataColumn
has aReadOnly
property and maybe this is being set to true somewhere else in your code. There are loads and loads of possible reasons, but from the error message, it clearly is not theDataGridView
that is causing the problem.Henry Minute Do not read medical books! You could die of a misprint. - Mark Twain Girl: (staring) "Why do you need an icy cucumber?" “I want to report a fraud. The government is lying to us all.”