WinForm 窗口之间传递参数的几种方法
(下面做了一个小示例,因其浅显易懂,就不加注释了
若有疑问可给我发邮件 yaotou
com) using System; usingSystem
Collections
Generic; usingSystem
ComponentModel; usingSystem
Data; usingSystem
Drawing; usingSystem
Linq; usingSystem
Text; usingSystem
Windows
Forms; namespaceWinPassValue { publicpartialclassMainForm : Form { publicMainForm() { InitializeComponent(); SelectedType(); } publicdelegatevoidChangeFormValue(string s1); //开始传递 privatevoidbtnPass_Click(object sender, EventArgs e) { if (cbmSelectedType
SelectedIndex == 3) { Form3 f3 = newForm3(txtValue); f3
Show(); } elseif (cbmSelectedType
SelectedIndex == 2) { Form2 f2 = newForm2(txtValue
Text); f2
Show(); } elseif (cbmSelectedType
SelectedIndex == 1) { Program
yourName = txtValue
Text; Form1 f1 = newForm1(); f1
Show(); } //利用Show方法重载实现
注意,此时要设