我正在处理一个涉及单击按钮的项目时遇到问题,并且文本应该显示在我创建的标签框中。我知道当我单击按钮时使用文本框显示文本会更容易,但我的导师希望我们使用标签而不是显示文本。我已经调试了项目,一切都说很好,但是当我单击底部的一个按钮时,文本不会显示在分配的标签中。下面是我正在使用的代码。也许我错过了一些东西。例如,当我点击客户关系按钮时,它应该在一个标签中显示部门,在下一个标签中显示联系人姓名,在下一个标签中显示电话号码。我希望这是足够的信息
private void btnCustomerRelations_Click(object sender, EventArgs e)
{
lblDepartment.Text = "Customer Relations";
lblContact.Text = "Tricia Smith";
lblPhone.Text = "500-1111";
}
private void btnMarketing_Click(object sender, EventArgs e)
{
lblDepartment.Text = "Marketing";
lblContact.Text = "Michelle Tyler";
lblPhone.Text = "500-2222";
}
private void btnOrderProcessing_Click(object sender, EventArgs e)
{
lblDepartment.Text = "Order Processing";
lblContact.Text = "Kenna Ross";
lblPhone.Text = "500-3333";
}
private void btnShipping_Click(object sender, EventArgs e)
{
lblDepartment.Text = "Shipping";
lblContact.Text = "Eric Johnson";
lblPhone.Text = "500-4444";
}