问题描述
我是Windows窗体的新手!
我创建了2个表单'Form1.cs'和'ComplainAssignment.cs'
''ComplainAssignment.cs'上的标签显示来自'Form1.cs'的文本TextBox控件名称'CustomerNametxt'
我想将'Form1'数据传递给'ComplainAssignment'表单,我是使用构造函数方法传递数据。
但'ComplainAssignment.cs'上的'LabelControl1'没有将'Form1.cs'TextBox中的Text显示到Label Control。
请帮助!
谢谢!
保存代码按钮:
private void SaveButton_Click( object sender,EventArgs e)
{
ComplainAssignment frm = new ComplainAssignment(Customer_Nametxt.Text);
frm.Show();
}
ComplainAssignment代码表格及字符串:
public partial class ComplainAssignment:表格
{
public ComplainAssignment( string strTextBox)
{
InitializeComponent();
labelControl1.Text = strTextBox;
}
Hi,
I am new to windows forms!
I have created 2 forms 'Form1.cs' and 'ComplainAssignment.cs'
A Label on 'ComplainAssignment.cs' to show the Text from 'Form1.cs' TextBox control name 'CustomerNametxt'
I want to pass 'Form1' data to 'ComplainAssignment' form, I am using constructor approach to pass data.
But the 'LabelControl1' on 'ComplainAssignment.cs' not displaying the Text from 'Form1.cs' TextBox to the Label Control.
Kindly Help!
Thank You!
Code of Save Button:
private void SaveButton_Click(object sender, EventArgs e) { ComplainAssignment frm = new ComplainAssignment(Customer_Nametxt.Text); frm.Show(); }
Code Of ComplainAssignment Form with string:
public partial class ComplainAssignment : Form { public ComplainAssignment(string strTextBox) { InitializeComponent(); labelControl1.Text = strTextBox; }
这篇关于如何在Windows窗体中将数据从一种形式传输到另一种形式?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!