开发者

how to copy data from Form to another Form using C#?

I have got 2 Forms. The first one contain Data Grid View 1 and the second one contains Data Grid View 2 and Button. I want code, using C#, that when the user clicks on Button, the dat开发者_StackOverflowa in the Data Grid View 2 is taken and displayed in Data Grid View 1. Can anyone can tell me how to do this in details please.


Depending on what you're really trying to do, I would suggest to make use of the BindingSource class in both your forms, and bind them according to what you need with your DataGridviews, then expose your BindingSource.DataSource through a Form property which will allow you to get and set the datasource outside of your Form, hence allowing you to change or update your [DataGridView.DataSource]4 property through this Form's property.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜