Click here to Skip to main content
16,004,453 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi I'm binding a dataset to DGV. adding a row ot DGV on click of add button and entering the data, have to check whether newly added row is already available like checking duplication and if its available I should not add same way while editing also. How can this be achieved is there any event related to it, pls help me out I'm new to this DGV usage.

Thanks in advance
Posted

1 solution

I haven't really tried it, but it seems to show some promise http://msdn.microsoft.com/en-us/library/det4aw50.aspx[^] . For the filter expression string, you can construct it using the row values you add in the datagrid (assuming you are also propogating these changes back to the dataset). The filter thing may be a bit tricky since you don't mention a clear primary key to check against, and so you may have to hack around a bit for that. If the returned array contains more than one value you would know that there are duplications and so you can reject the changes, otherwise accept them.

HTH
Cheers...
 
Share this answer
 

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