how to set datagridview cell txt
I have datagridview and I need to set the cell text to either Y or N. It is databinded to a business object.
grid[columnIndex, rowIndex].readonly = false;
grid[columnIndex, rowIndex].value = "Y";
grid[columnIndex, rowIndex].readonly = true;
When the cell value is equal to "N" and it passes the code, the cell will not change to "Y".
Any help is greatly appreciated.
[402 byte] By [
comicrage] at [2007-11-20 11:08:28]

# 1 Re: how to set datagridview cell txt
I have datagridview and I need to set the cell text to either Y or N. It is databinded to a business object.
grid[columnIndex, rowIndex].readonly = false;
grid[columnIndex, rowIndex].value = "Y";
grid[columnIndex, rowIndex].readonly = true;
When the cell value is equal to "N" and it passes the code, the cell will not change to "Y".
Any help is greatly appreciated.Whats about changing the value simple in the database where the control is bound to and doing a refresh cycle then to get it seen in the grid ?
# 2 Re: how to set datagridview cell txt
Firstly, changing the ReadOnly property is pointless because that only applies to whether the user can change the value through the UI, not to code. Secondly, as JP suggests, when your grid is bound you should always work with the data source where you can, NOT the UI.