Prevent edits in one datagrid column

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a datagrid bound to a datatable with only two columns.
This is a list of properties and their values.
I want the user to be able to perform edits only on the property values
but I don't want them to be able to edit the property names.

I can use the keypress event to cancel the keypress if the
currentcell.columnnumber is 0.
Is there a slicker way to handle this?

Regards,
Erik
 
Hi,

Add a tablestyle to your datagrid. Set the readonly property of the
datagridtextboxcolumn to true for the column you do not want the user to
edit.

Link on how to add a tablestyle to a datagrid

http://msdn.microsoft.com/library/d...tingwindowsformsdatagridvisualbasicprimer.asp


Ken
----------------------
I have a datagrid bound to a datatable with only two columns.
This is a list of properties and their values.
I want the user to be able to perform edits only on the property values
but I don't want them to be able to edit the property names.

I can use the keypress event to cancel the keypress if the
currentcell.columnnumber is 0.
Is there a slicker way to handle this?

Regards,
Erik
 

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

Back
Top