111,013
社区成员
发帖
与我相关
我的任务
分享
private void Button1_Click(object sender, EventArgs e)
{
Form2 myForm2 = new Form2();
myForm2.Str = "2010世界末日";
DialogResult result = myForm2.ShowDialog();
if (result == DialogResult.OK)
{
//comboBox1.Items.Add(myForm2.Str);
textBox1.Text = myForm2.Str;
}
}
public string s
{
get
{
return this.textBox1.Text;
}
set
{
this.textBox1.Text = value;
}
}
Form1
Form2 f2 = new Form2 ( );
f2.s= "";
f2.ShowDialog();
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Button1_Click(object sender, EventArgs e)
{
Form2 myForm2 = new Form2();
myForm2.Str = "2010世界末日";
DialogResult result = myForm2.ShowDialog();
if (result == DialogResult.OK)
{
comboBox1.Items.Add(myForm2.Str);
}
}
}
public partial class Form2 : Form
{
private string TestString;
public Form2()
{
InitializeComponent();
}
public string Str
{
get
{
return TestString;
}
set
{
TestString = value;
}
}
private void Form2_Load(object sender, EventArgs e)
{
textBox1.Text = TestString;
}
private void textBox1_TextChanged(object sender, EventArgs e)
{
this.TestString = textBox1.Text;
}
}