I have a datagridview which has some cells that are editable, some that are readonly.
My program has an "edit" and "run" mode. In Edit mode, the editable cells can be edited, but in Run mode, I want all cells to be readonly.
In run mode, if I simply set the datagridview to readonly, it actually seems to overwrite the cells' readonly setting. All of the cells that is. So when I go back to edit mode, and set datagridview.readonly to false, ALL the cells, including the ones that were originally readonly, are now readonly=false.
Ok, so I can accept (lame as it is) that setting datagridview.readonly to true or false does nothing more than set all the child controls to .readonly=true or false. It would be nice if it didn't affect each control, but that's what it seems to do.
So, how do I solve this? I thought maybe if I store the cells initial readonly state into it's tag, then I can reset the readonly state of the control by setting it to whatever it is in the tag. Simple enough, but I'm not sure how to override the readonly property in every control to work that way. I'd also like to do this for other controls on the form as well, so having all controls store their initial state in the tag property and then when readonly=false just read the tag setting to set it back to whatever it was originally would be great.
So how do I change the functionality of the readonly property for all controls at once?
Or, can you think of a better way to do all this?
My program has an "edit" and "run" mode. In Edit mode, the editable cells can be edited, but in Run mode, I want all cells to be readonly.
In run mode, if I simply set the datagridview to readonly, it actually seems to overwrite the cells' readonly setting. All of the cells that is. So when I go back to edit mode, and set datagridview.readonly to false, ALL the cells, including the ones that were originally readonly, are now readonly=false.
Ok, so I can accept (lame as it is) that setting datagridview.readonly to true or false does nothing more than set all the child controls to .readonly=true or false. It would be nice if it didn't affect each control, but that's what it seems to do.
So, how do I solve this? I thought maybe if I store the cells initial readonly state into it's tag, then I can reset the readonly state of the control by setting it to whatever it is in the tag. Simple enough, but I'm not sure how to override the readonly property in every control to work that way. I'd also like to do this for other controls on the form as well, so having all controls store their initial state in the tag property and then when readonly=false just read the tag setting to set it back to whatever it was originally would be great.
So how do I change the functionality of the readonly property for all controls at once?
Or, can you think of a better way to do all this?