我正在尝试使用 WinForms 制作一个邮寄标签程序,您可以在其中输入您的姓名、州、城市等,然后单击一个按钮,它会显示您在每个框中输入的所有文本并将其显示在一个标签上。我很接近但是当我运行我的程序时,单词之间没有空格。这是我的代码:
namespace Mail_Label_Program
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void btnDisplay_Click(object sender, EventArgs e)
{
lblMessage.Text = txtFirst.Text + txtLast.Text;
}
private void btnExit_Click(object sender, EventArgs e)
{
//This closes the program.
this.Close();
}
private void btnClear_Click(object sender, EventArgs e)
{
//This clears all textbox forms.
txtFirst.Text = string.Empty;
txtLast.Text = string.Empty;
txtCity.Text = string.Empty;
txtStreet.Text = string.Empty;
txtState.Text = string.Empty;
txtZip.Text = string.Empty;
}
}
}