如何在Visual C#中使用DisplayLabel.Text?

时间:2014-01-29 20:13:32

标签: c# visual-studio visual-studio-2012

我试图在单击按钮时在标签中显示某些文本,但我总是得到错误`当前上下文中不存在名称DisplayLabel。这是我的代码。

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace Chapter_2_HW
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void sinisterButton_Click(object sender, EventArgs e)
        {
            MessageBox.Show("Left");
        }

        private void mediumButton_Click(object sender, EventArgs e)
        {

        }

        private void dexterButton_Click(object sender, EventArgs e)
        {

        }

        private void instructionLabel_Click(object sender, EventArgs e)
        {

        }

        private void translateLabel_Click(object sender, EventArgs e)
        {
            DisplayLabel.Text = "Goodbye";
        }
    }
}

0 个答案:

没有答案