Objetivo.
Hacer una aplicación para aprender el uso y aplicaciones de un Radio Button y Checkbox.
Código.
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 practica_9
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void label2_Click(object sender, EventArgs e)
{
}
private void button1_Click(object sender, EventArgs e)
{
label2.Visible = true;
label3.Visible = true;
label4.Visible = true;
label6.Visible = true;
if (rbHombre.Checked)
{
label3.Text = "Hombre";
}
if (rbMujer.Checked)
{
label3.Text = "Mujer";
}
if (checkBox1.Checked)
{
label6.Text += "C++ ";
}
if (checkBox2.Checked)
{
label6.Text += "Java ";
}
if (checkBox3.Checked)
{
label6.Text += "C# ";
}
if (checkBox4.Checked)
{
label6.Text += "Pascal ";
}
if (checkBox5.Checked)
{
label6.Text += "Python ";
}
if (label6.Text=="")
{
label6.Text += "Ninguno ";
}
}
private void button2_Click(object sender, EventArgs e)
{
label2.Visible = false;
label3.Visible = false;
label4.Visible = false;
label6.Visible = false;
label6.Text = "";
label3.Text = "";
checkBox1.Checked = false;
checkBox2.Checked = false;
checkBox3.Checked = false;
checkBox4.Checked = false;
checkBox5.Checked = false;
}
private void button3_Click(object sender, EventArgs e)
{
Close();
}
private void Form1_Load(object sender, EventArgs e)
{
}
}
}
Autor: Eduardo Saavedra Pérez.
No hay comentarios:
Publicar un comentario