本文介绍了如何显示从Form1到Form3的多个值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我是C#的新手,我想将我的textBox1,textBox2和textBox3的值从form1显示到表单3中的标签.但是它只显示空格.有人可以告诉我该怎么做吗?
I'm new to C# and I want to display the Values of my textBox1, textBox2, and textBox3 from form1 to my labels in form 3. But it just show blank spaces. Can someone show me how to do it?
图片:
推荐答案
您可以执行此操作,只需在表单1上单击按钮即可.
You can do this, on button click in form 1,
private void btnTransfer_Click(object sender, EventArgs e)
{
Form3 frmdisplay = new Form3(txtFirstName.Text.ToString(), txtSecondName.Text.ToString(), txtPay.Text.ToString());
frmdisplay.Show();
}
并以这种形式显示在表格3中,
and show it in form 3 like this,
public Form3(string Firstname,string Lastname ,string Pay)
{
InitializeComponent();
lblName.Text = "Your name is" + Firstname +" "+ Lastname ;
lblPayment.Text = "Your payment is" + Pay;
}
这篇关于如何显示从Form1到Form3的多个值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!