Click here to Skip to main content
15,920,655 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a button in one form which is MDIParent and DGV in another form. Want to delete the records of DGV on click of the delete button in MDI, by checking some conditions. I dont want the frmForm frm = new frmForm()
Anyone can help me with some idea.

Thanks in Advance
Updated 21-Oct-11 18:55pm

1 solution

There are two way you can handle this - and they both involve the work being done in the form containing the DGV.
The first is to create a property or method in the form, which is given the identity of the row to delete. You then call this by reference to the instance of the child form from when it was created.

The other is to provide an event in the parent form to which the child subscribes. The parent signals the event (possibly with a custom EventArgs to pass through the identity of the records to remove) and teh child handles it, deleting the records.

Personally, I would go with the second option.
Share this answer
TweakBird 22-Oct-11 4:12am    
My Vote also to Second option.

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