Data Grid View & Read Only

Data Grid View< xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Any one else having problems setting a single column to ready only

 

dgv.Columns("myValue").ReadOnly.Equals(True)

 

Or am I missing something here



Answer this question

Data Grid View & Read Only

  • mike1942f

    dgv.Columns("myValue").ReadOnly = True

    Tried that before also but a no go.
    Any other ideas

    Note this is a windows form


  • Farpetrad

    You're just checking if ReadOnly is true. You have to set it:


    'Courier New'; mso-highlight: silver; mso-no-proof: yes">dgv.Columns("myValue").ReadOnly = True
     



  • Harish

    Can you provide more details here. Are you still able to edit a value in the column

    -mark
    DataGridView Program Manager
    Microsoft
    This post is provided "as-is"

  • DRoden

    I had a similar problem, I caste the columns collection to a BoundField, or a BoundColumns like so,..
    ((BoundField) dgv.Columns("myValue")).ReadOnly = true;

    in order to reveal access to the ReadOnly method.
    this will only work if the columns collection is actually holding a BoundField object

  • Data Grid View & Read Only