Is this possible in DataGridView?

B

B. Chernick

I have a Winforms app (Dot Net 2.0) with a datagridview bound to a table. I
am supposed to be able to add, edit, and delete rows. One particular column
is to be read-only for existing records. Both the program and the data
structure are works in progress.

It appears that what I need to do is to make the cell of that read-only
column editable for record adds only. Is this possible?
 
B

B. Chernick

Never mind. Found it (I think).

Private Sub dgvParts_RowEnter(ByVal sender As Object, ByVal e As
System.Windows.Forms.DataGridViewCellEventArgs) Handles dgvParts.RowEnter
If dgvParts.Rows(e.RowIndex).IsNewRow Then
dgvParts.Rows(e.RowIndex).Cells(0).ReadOnly = False
End If
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top