How to make datagridview cell readonly in vb.net

    Private Sub DataGridView1_CellMouseClick(sender As Object, e As DataGridViewCellMouseEventArgs) Handles DataGridView1.CellMouseClick
        If e.RowIndex < 0 Then
            Exit Sub
        End If
       
        If e.ColumnIndex = 1 Then
            DataGridView1.CurrentCell.ReadOnly = False
        Else
            DataGridView1.CurrentCell.ReadOnly = True
        End If
    End Sub

You May Also Like

Leave a Reply

Your email address will not be published. Required fields are marked *