none
How to make columns in datagridview non-editable or editable

    Question

  • Dear all,

    How to make some columns in datagridview editable and some columns are non-editable in the same datagridview control??

    Wednesday, June 01, 2011 3:24 AM

Answers

  • Raymond,

    You can do that in the designer, rightclick on the datagridview, select the column and set it to ReadOnly = true

    It results in this code in the designer.vb

     '
        'Column1
        '
        Me.Column1.HeaderText = "Column1"
        Me.Column1.Name = "Column1"
        Me.Column1.ReadOnly = True
        '
    


    Success
    Cor
    Wednesday, June 01, 2011 4:38 AM
  • You can do that by setting the column(s) that you want to be non-editable, as readonly

    E.g

    DGView.Columns("ColumnName").ReadOnly = True

     

     


    Regards Pranabjyoti
    Wednesday, June 01, 2011 6:13 AM

All replies

  • Raymond,

    You can do that in the designer, rightclick on the datagridview, select the column and set it to ReadOnly = true

    It results in this code in the designer.vb

     '
        'Column1
        '
        Me.Column1.HeaderText = "Column1"
        Me.Column1.Name = "Column1"
        Me.Column1.ReadOnly = True
        '
    


    Success
    Cor
    Wednesday, June 01, 2011 4:38 AM
  • You can do that by setting the column(s) that you want to be non-editable, as readonly

    E.g

    DGView.Columns("ColumnName").ReadOnly = True

     

     


    Regards Pranabjyoti
    Wednesday, June 01, 2011 6:13 AM