Click here to Skip to main content
15,884,298 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
i have taken gridview in one form and taken the sql connection and displayed the all data.Now i have taken another form and pass the values from gridview to Second form textboxes. Here i want to make changes to data(Insert,update,delete).

But i am not accessing gridview in second form.any one can help me
Posted

1 solution

Don't do it.

You can expose the GridView from one form to others, by declaring it public instead of private but it is not a good idea - it ties the two forms together so that one form cannot change without affecting the other. This is against the principles of OOP.

Instead, provide a public property or method which accepts the changes and passes them into the GridView. That way, the internals of the form are not exposed and it can be re-used by other parts of your app.
 
Share this answer
 
Comments
baluILU 16-Nov-10 4:30am    
Thanks

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