none
Can't Set Datagridview column to Readonly = false RRS feed

  • Question

  • Hello,

    I have a datagridview that is bound using a bindingsource. There are several column i do not want to show up in the datagridview, so i have set them to visible = false. Readonly was set to false on all these columns as well, however one column (the primary key column) sets itself back to readonly = True. I am settign it in design mode, and if i go back into edit columns after changing it to false it says True again. on the whole this wouldn't really be a big problem but If readonly is set to True it will ignore the fact that Visible is set to false and show the column anyway. I can not figure out why this keep re-setting itself. I am self taught and still a noob on some of this stuff. Please help if you can. Thanks!

    Thursday, July 5, 2012 7:31 PM

Answers

  • Hi Josh,

    I'm assume the readonly column in the database is read only.

    Open the xsd file in the designer, open the property windows, change the ReadOnly property to false, then you can change the DataGridViewColumn's readonly property.

    Another way is changing in the SQL Server immediately, try setting identity column property to No.
    Best Regards,


    Bob Wu [MSFT]
    MSDN Community Support | Feedback to us

    Monday, July 9, 2012 8:07 AM
    Moderator

All replies

  • Hi Josh,

    I'm assume the readonly column in the database is read only.

    Open the xsd file in the designer, open the property windows, change the ReadOnly property to false, then you can change the DataGridViewColumn's readonly property.

    Another way is changing in the SQL Server immediately, try setting identity column property to No.
    Best Regards,


    Bob Wu [MSFT]
    MSDN Community Support | Feedback to us

    Monday, July 9, 2012 8:07 AM
    Moderator
  • Thank you for the help, but, as you can see in my question i am setting this in properties in design view. The problem is after i make the change and save it if I go back to properties it has changed itself back to read only = True 
    Monday, July 9, 2012 6:20 PM
  • Thank you for the help, but, as you can see in my question i am setting this in properties in design view. The problem is after i make the change and save it if I go back to properties it has changed itself back to read only = True 

    Yes, this is because the column is readonly. You need to change the column property in the database.

    Best Regards,


    Bob Wu [MSFT]
    MSDN Community Support | Feedback to us


    Tuesday, July 10, 2012 5:11 AM
    Moderator
  • What database?
    Wednesday, July 29, 2015 12:49 PM
  • Not database, but rather in the dataset.
    Thursday, January 30, 2020 2:29 AM