且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

将值从父窗体传递到子窗体?

更新时间:2023-12-06 13:21:22

看这个例子.

1-创建一个窗体应用程序,在 Form1 中声明一个公共字符串全局变量,使用这个变量我们可以将值从 Form1 传递给 Form2.

1-Create a window form application,Declare a public string global variable in Form1 , using this variable we can pass value from Form1 to Form2.

2-现在在form2中,为Form1创建一个对象并使用这个对象获取值.

2-Now in form2 ,Create a object for Form1 and Get the value using this object.

看图