简体   繁体   中英

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 data 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.

根据您的实际尝试,我建议您在两个表单中都使用BindingSource类,并根据需要使用DataGridview绑定它们,然后通过Form属性公开BindingSource.DataSource将允许您获取和设置Form外部的数据源,从而允许您通过此Form的属性更改或更新[DataGridView.DataSource ] 4属性。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM