例如,有A,B两窗体,怎么样在B窗中访问到A中的textBox.text的值
解决方案 »
- WPF里Popup怎么大到一定限度就显示不完整了呢?
- kindeditor 在asp.net中母版的使用问题
- 求一个取超链接的正则表达式
- 求 IDEA加解密算法C#版,JS版!
- 求一道微软考试题的答案
- 在c#中如何改变Excel中的边框的颜色????
- windows service 中如何定时执行(C# 2.0)?
- 怎么实现 string 或 StringBuilder 从后向前搜索制定字符?
- HttpHandler是否可以截获对非项目中页面的http请求
- 如何在两个web页面之间传递一个数组啊?
- 求一正則表達式((((( 隻取正實數)??
- 好怪的错误!程序刚刚还是运行还是好的,而且没有任何改动,现在就出现这个错误,不知道是不是系统出了问题
B frb=new (this.TextBox.Text);
frb.ShowDialog();
B窗体中:
private string txt;
public B(string TXT)
{
//
//
txt=TXT;
InitializeComponent(); // Add any initialization after the InitializeComponent() call
}
后面就可以对txt(也就是A窗体中的text)进行操作了
public class b : System.Windows.Forms.Form
{
private string strValue="";
public string Value
{
set
{dstReport=value;}
}
}private void button1_Click(object sender, System.EventArgs e)//a 窗体中某按钮的单击事件
{
b ss=new Rb();
ss.Value=textBox.text;
ss.Show();
}
在属性中设置 TextBox 访问性 为 public
B frb=new (this.TextBox);
frb.ShowDialog();
B窗体中:
private string txt;
public B( TextBox TXT)
{
//
//
TextBox txt=TXT;
InitializeComponent(); // Add any initialization after the InitializeComponent() call
}
后面就可以对txt.Text(也就是A窗体中的TextBox.Text)进行操作了
在属性中设置 TextBox 访问性 为 public
B frb=new (this.TextBox);
frb.ShowDialog();
B窗体中:
private TextBox txt;
public B( TextBox TXT)
{
//
//
TextBox txt=TXT;
InitializeComponent(); // Add any initialization after the InitializeComponent() call
}
后面就可以对txt.Text(也就是A窗体中的TextBox.Text)进行操作了
public class b : System.Windows.Forms.Form
{
private string strValue="";
public string Value
{
set
{dstReport=value;}
}
}private void button1_Click(object sender, System.EventArgs e)//a 窗体中某按钮的单击事件
{
b ss=new b();
ss.Value=textBox.text;
ss.Show();
}
非常好的文章,看了就明白是怎么回事了
//Form2.cs
public delegate void ChangeText(object sender);
public ChangeText changeText;changeText = new ChangeText(MyFunc);
private void MyFunc(object sender)
{
textBox2.Text = ((TextBox)sender).Text;
}
//Form1.cs
public Form2 form2;
private void textBox1_TextChanged(object sender, System.EventArgs e)
{
if(form2 != null)
{
form2.changeText(sender);
}
}private void button1_Click(object sender, System.EventArgs e)
{
form2 = new Form2();
form2.Show();
}