Wednesday, July 20, 2011

Switch, Variable Global y Windows Forms

Programa ejercicio 8
Este programa va en Form1.cs
Ocupa un botón llamado button1 y una etiqueta llamada Etiqueta1


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

namespace Ejercicio8
{
public partial class Form1 : Form
{
int estado1 = 0;
public Form1()
{
InitializeComponent();
}

private void Boton1_Click(object sender, EventArgs e)
{
estado1++;
switch (estado1)
{
case 1: { Etiqueta1.Text="EXCELENTE";break;}
case 2: { Etiqueta1.Text="MEJORANDO";break;}
case 3: { Etiqueta1.Text="FELICIDADES";break;}
default: { estado1 = 1; break; }

}
}


}
}

No comments:

Post a Comment