110,571
社区成员
发帖
与我相关
我的任务
分享
namespace WindowsFormsApplication1
{
public class app
{
public static string k;
}
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
Form2 f2 = new Form2();
f2.ShowDialog(this);
f2.Dispose();
textBox1.Text = app.k;
}
}
}
public partial class Form2 : Form
{
public Form2()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
app.k = textBox1.Text;
this.Close();
}
}
public Form2(string ss)
{
this.m_ss = ss;
}
Form2 frm = new Form2("123");
public string public_ss = "";
public Form2()
{
InitializeComponent();
}
//form1
Form2 frm = new Form2();
frm.public_ss = "123";
private string m_ss = "";
public Form2(string ss)
{
this.m_ss = ss;
}
public string SS
{
get { return this.m_ss; }
set { this.m_ss = value; }
}
//form1
Form2 frm = new Form2();
frm.SS = "123";