如何获取子窗口数据 现在有两窗口Form1和Form2,现在我想请问下,如何在Form1中获取Form2中的TextBox中的值? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 http://topic.csdn.net/u/20110407/19/c1068d69-7331-4d02-bc0b-f5ba7a5f8dd8.html 给你个简单的form2里面这样写:public partial class Form2 : Form { public Form2() { InitializeComponent(); } public string Txt { get { this.textBox1.Text = "这是form2的代码"; return this.textBox1.Text; } } }form1里面这样就可以了 public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void button1_Click(object sender, EventArgs e) { MessageBox.Show( GetFormTextBoxValle(new Form2())); } private string GetFormTextBoxValle(Form2 frm) { if(frm!=null) { return frm.Txt; } return string.Empty; } } string.Empty;有点不懂是什么意思………… sql语句中的时间比较 asp页面怎样在运行.cs文件之前进行JS判断 【初学者求教】Socket编程 .net 设置图片显示个数 C# 控件问题,具体如下 app.config 怎么不同步 高分请教pop3收信(全副家当就20分 谢谢) 请问如何附加到进程? 建议:合并VB.net、C#、C#B、Delphi.net、J#版块 我新建一个C#工程,...... 如何动态获取数据表字段…… 关于获取网页源代码的速度问题
form2里面这样写:
public partial class Form2 : Form
{
public Form2()
{
InitializeComponent();
}
public string Txt
{
get
{
this.textBox1.Text = "这是form2的代码";
return this.textBox1.Text;
}
}
}form1里面这样就可以了
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
} private void button1_Click(object sender, EventArgs e)
{
MessageBox.Show( GetFormTextBoxValle(new Form2()));
} private string GetFormTextBoxValle(Form2 frm)
{
if(frm!=null)
{
return frm.Txt;
}
return string.Empty;
}
}