【发布时间】:2020-08-19 23:35:00
【问题描述】:
我的 form3 中有 TextBox eingabe
现在我的计划是将 TextBox eingabe 保存为字符串,然后在我的 form4 上给出字符串
这怎么可能?我试过了:
//form3.cs
public partial class Form3 : Form
{
public Form3()
{
InitializeComponent();
}
private void eingabe_TextChanged(object sender, EventArgs e)
{
}
private void openWindow(object sender, EventArgs e)
{
this.Hide();
Form4 form4 = new Form4();
form4.ShowDialog();
String help = eingabe.Text;
}
}
//form4.cs
public partial class Form4 : Form
{
public Form4()
{
InitializeComponent();
}
private void Form4_Load(object sender, EventArgs e)
{
ausgabe = help;
}
private void ausgabe_Click(object sender, EventArgs e)
{
}
}
这行不通。 请不要评判我,我对这一切都很陌生...
【问题讨论】:
-
你使用哪个框架? WPF 还是 WinForms?
-
还有
label1是什么类型的?是Label还是TextBlock -
查找
.Text或.Value属性 -
@Ackdari 我使用 Windows 窗体框架。
label1是一个Label -
这能回答你的问题吗? C# get string from textbox