Change Readonly columns on Datagridview to Updateable when Adding New Row

gprabaka

Newcomer
Joined
Jul 14, 2005
Messages
21
I have a datagridview on a Windows form. The first 2 columns are the key fields for the table in the database, so I have have them formatted on the grid as ReadOnly. However, I need to make them editable when adding a new row. Can someone advise me as to how this can be done.
Thanks
Guha
 
I don't think you really want to do that, do you? You shouldn't allow the user to edit the "key" fields. The "key" fields should only be changed through communication with the database, or in the DataTable through code that you write.

Todd
 
Well, It is not a key field like an ID. However it does need to be populated. For example if we have table like Customer and a table Order. The Order while populating the Order table we will need to populate the Customer# as the foreign key. The would have to be a user selected/entered field.
Thanks
Guha
 
Back
Top