Click here to Skip to main content
14,970,162 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Dear All,

I have 2 datagridviews(SHOP & FIELD) in one windows form binding from same table.I want to prevent editing or inserting columns in FIELD datagridview while editing or inserting in SHOP datagridview & vice versa.

Kindly help to sort it out.

What I have tried:

Tried to fetch from the datagridview row unchanged,its not working.
Posted
Updated 8-Jun-21 22:17pm
Comments
Richard MacCutchan 9-Jun-21 4:15am
   
"Kindly help to sort it out."
Sort what out? We have no idea what your code is doing. Please use the Improve question link below your question, and add complete details.

1 solution

If they are in one form then it is physically impossible to edit both at the same time, however I am going to assume that you mean edits in on dgv must be complete and committed to the datasource before starting edits in the other.

I would probably keep it simple and toggle the ReadOnly property[^] in an appropriate event from the opposing dgv e.g. CellBeginEdit[^] or UserAddedRow[^]. However, you shouldn't need the latter if you are binding to a table - you will need to have some means of inserting new rows into the datasource - and that is where you should prevent editing of the opposing dgv
   

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900