Cambiar el texto de la etiqueta en C#
 
Aprenderemos cómo cambiar el texto de la etiqueta en C# en este tutorial. Podemos cambiar fácilmente el texto de una etiqueta en un formulario de Windows en C# siguiendo estos pasos.
Cambiar el texto de la etiqueta en C#
    
Crearemos un formulario de Windows y cambiaremos el texto de la etiqueta con algunos botones en este ejemplo. Podemos cambiar fácilmente el texto de una etiqueta en un formulario de Windows en C# siguiendo estos pasos.
Las bibliotecas que estarían en necesidad se encuentran a continuación.
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;
Primero, cree un nuevo formulario de Windows haciendo clic en Archivo / Nuevo / Proyecto; Una ventana nueva aparecerá.
Seleccione Visual C# en la vista de lista de la izquierda, seleccione Aplicación de formularios de ventana (.Net Framework), asigne un nombre al proyecto y haga clic en Ok.
Después de hacer clic, aparecerá un formulario de Windows vacío.
Agregue 3 botones de la vista de lista izquierda llamados Toolbox, y nombre los botones HelloFolksbtn, startlearningbtn y betterpersonbtn, respectivamente.
Ahora escriba el texto en el botón cuyo texto desea mostrar en la etiqueta; por ejemplo, vea la imagen de abajo.

Haga doble clic en Hello Folks! botón; generará un evento y escribirá código en este evento como este.
private void HelloFolksbtn_Click(object sender, EventArgs e) {
  changetext.Text = "Hi Folks!";
}
El nombre de la etiqueta donde aparecerá el texto es changetext.
Genere el evento startlearningbtn_Click haciendo doble clic en el botón Lets Start Learning y escribiendo la siguiente línea de código.
private void startlearningbtn_Click(object sender, EventArgs e) {
  changetext.Text = "Lets Start Learning";
}
Por último, crea el evento betterpersonbtn_Click haciendo doble clic en el botón Learn to be a better person y escribiendo este código.
private void betterpersonbtn_Click(object sender, EventArgs e) {
  changetext.Text = "Learn to be a better person";
}
Código fuente completo:
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 change_label_text {
  public partial class Form1 : Form {
    public Form1() {
      InitializeComponent();
    }
    private void HelloFolksbtn_Click(object sender, EventArgs e) {
      changetext.Text = "Hey Folks!";
    }
    private void startlearningbtn_Click(object sender, EventArgs e) {
      changetext.Text = "Lets Start Learning";
    }
    private void betterpersonbtn_Click(object sender, EventArgs e) {
      changetext.Text = "Learn to be a better person";
    }
  }
}
Después de hacer clic en Hello Folks! botón, el texto de la etiqueta cambiará en tiempo de ejecución y obtendrá el siguiente resultado.

I have been working as a Flutter app developer for a year now. Firebase and SQLite have been crucial in the development of my android apps. I have experience with C#, Windows Form Based C#, C, Java, PHP on WampServer, and HTML/CSS on MYSQL, and I have authored articles on their theory and issue solving. I'm a senior in an undergraduate program for a bachelor's degree in Information Technology.
LinkedIn