Documentos de Académico
Documentos de Profesional
Documentos de Cultura
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 WindowsFormsApplicationTextBox1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
int valor1 = int.Parse(textBox1.Text);
int valor2 = int.Parse(textBox2.Text);
int suma = valor1 + valor2;
label4.Text = suma.ToString();
}
}
}
NUMERO DE USUARIO Y CONTRASEÑA
Solicitar que se ingrese una clave. Si se ingresa la cadena "abc123" mostrar un
mensaje de clave correcta en caso contrario mostrar clave incorrecta.Utilizar un
control de tipo TextBox para el ingreso de la clave y una Label para mostrar el
resultado al presionar un botón.
CODIGO
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 WindowsFormsApplicationTextBox2
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
if (textBox1.Text == "abc123")
{
label2.Text = "Clave correcta";
}
else
{
label2.Text = "Clave incorrecta";
}
}
}
}
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 WindowsFormsApplicationRadioButton1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
MENSAJE
Disponer un control Label que muestre el siguiente mensaje: "Esta de acuerdo
con las normas del servicio?", luego un CheckBox y finalmente un objeto de tipo
Button desactivo Cuando se tilde el CheckBox debemos activar el botón
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 WindowsFormsApplicationCheckBox2
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void checkBox1_CheckedChanged(object sender, EventArgs e)
{
if (checkBox1.Checked == true)
{
button1.Enabled = true;
}
else
{
button1.Enabled = false;
}
}
}
}
MUESTRA OBJETOS
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 WindowsFormsApplicationCheckBox1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
for(int i=1;i<=numalumnos;i=i+1)
{
nota
=Convert.ToDouble(Microsoft.VisualBasic.Interaction.InputBox("Ingrese nota
del alumno "+i,"Promedio Notas","16",100,100));
sumanotas = sumanotas + nota;
if(nota<notabaja)
{
notabaja = nota;
}
}
promedio = sumanotas / numalumnos;
//Salida de Información
txtpromedio.Text = Convert.ToString(promedio);
txtnotabaja.Text = Convert.ToString(notabaja);
}
else
{
MessageBox.Show("Ingrese un número válido", "Promedio
Notas",MessageBoxButtons.OK, MessageBoxIcon.Error);
}
private void btnnuevo_Click(object sender, EventArgs e)
{
txtnumero.Clear();
txtnotabaja.Clear();
txtpromedio.Clear();
}
CAPITAL Y TASA DE INTERES
Crea una aplicación sencilla que dado el capital y la tasa de interés calcule el
interés conseguido y el capital final. La fórmula para el cálculo del interés
es I=(C*t)/100siendo C el capital inicial y r la tasa de interés nominal anual en
tanto por ciento. El capital acumulado será el capital inicial más el interés.
FACTORIAL DE UN NUMERO
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 Factorial_E_Repetitivas
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
Application.Exit();
}
private void button2_Click(object sender, EventArgs e)
{
int n, f = 1;
n = int.Parse(textBox1.Text);
for (int i=1; i<= n; i++)
{
f *= i;
textBox2.Text = f.ToString();
}
}
private void button3_Click(object sender, EventArgs e)
{
int n, f = 1, i = 1;
n = int.Parse(textBox1.Text);
while (i <= n)
{
f *= i;
i++;
textBox3.Text = f.ToString();
}
}
private void button4_Click(object sender, EventArgs e)
{
int n, f = 1, i = 1;
n = int.Parse(textBox1.Text);
do
{
f *= i;
i++;
}
while
(i <= n);
textBox4.Text = f.ToString();
}
}
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 numero4
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
int numero;
string letra
private void textBox1_TextChanged(object sender, EventArgs e)
{
numero = int.Parse(textBox1.Text);
}
NUMERO PRIMO
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 numero5
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
//Variables
int numeroentrada, i;
bool flag;
string respuesta = "";
//Entrada
// Proceso y Salida
textBox2.Text = respuesta;
}
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 numero7
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
//Variables
string texto;
int cantidad;
//Entrada
private void textBox1_TextChanged(object sender, EventArgs e)
{
texto = entrada.Text;
}
ORDENACION POR INTERCAMBIOS
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 numero11
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
//Variables
int tmp, i, j, LI, LS;
//Arreglos
int[] n = new int[4];
RECONOCIMIENTO DE VOZ
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;
using System.Speech.Recognition; // Para el reconocimiento de voz
namespace Reconocimiento_de_voz_1
{
public partial class Form1 : Form
{
string palabras;
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e) //Boton escuchar.
Configuración del reconocimiento
{
//Inicia la escucha con el dispositivo de entrada de audio predeterminado
reconocimiento_de_voz.SetInputToDefaultAudioDevice(); // Usaremos el
microfono predeterminado del sistema
reconocimiento_de_voz.LoadGrammar(new DictationGrammar()); //Carga la
gramatica de Windows
reconocimiento_de_voz.SpeechRecognized += te_escucho; // Controlador de
eventos. Se ejecutara al reconocer
reconocimiento_de_voz.RecognizeAsync(RecognizeMode.Multiple);
//Iniciamos reconocimiento
label1.Text = "Te estoy escuchando cuentame: ";
}
void te_escucho(object sender, SpeechRecognizedEventArgs e)
{
palabras = e.Result.Text; // La variable palabras del tipo string toma las
palabras reconocidas.
textBox1.Text = palabras; // Muestra las palabras reconocidas en el textbox
}
private void button3_Click(object sender, EventArgs e) // Boton detener
escucha
{
reconocimiento_de_voz.RecognizeAsyncStop(); //Detiene la escucha
textBox1.Clear(); //limpia el textbox
}
private void button2_Click(object sender, EventArgs e) // Boton Salir
{
Application.Exit();
}
}
}
TABLA DE MULTIPLICAR
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 TablaMultiplicar
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
//Variables
int numero;
NUMEROS ROMANOS
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 NumerosRomanos_Forms
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
int numeroentrada;
private void button2_Click(object sender, EventArgs e)
{
Application.Exit();
}
private void button1_Click(object sender, EventArgs e)
{
int Miles, Centenas, Decenas, Unidades, RestoMiles, RestoCentenas,
RestoDecenas, N;
N = numeroentrada;
Miles = N / 1000;
RestoMiles = N % 1000;
Centenas = RestoMiles / 100;
RestoCentenas = RestoMiles % 100;
Decenas = RestoCentenas / 10;
RestoDecenas = RestoCentenas % 10;
Unidades = RestoDecenas;
switch (Miles)
{
case 1: textBox2.Text += "M"; break;
case 2: textBox2.Text += "MM"; break;
case 3: textBox2.Text += "MMM"; break;
}
switch (Centenas)
{
case 1: textBox2.Text += "C"; break;
case 2: textBox2.Text += "CC"; break;
case 3: textBox2.Text += "CCC"; break;
case 4: textBox2.Text += "CD"; break;
case 5: textBox2.Text += "D"; break;
case 6: textBox2.Text += "DC"; break;
case 7: textBox2.Text += "DCC"; break;
case 8: textBox2.Text += "DCCC"; break;
case 9: textBox2.Text += "CM"; break;
}
MAXIMO COMUN DIVISOR
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 MCD_I_Forms
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
int numero1, numero2, a, b, resultado;
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
namespace MEF
{
// Objetos necesarios
public S_objeto[] ListaObjetos = new S_objeto[10];
public S_objeto MiBateria;
public Form1()
{ InitializeComponent();
Random random = new Random();
// Recorremos todos los objetos
for (int n = 0; n < 10; n++)
{
// Colocamos las coordenadas
ListaObjetos[n].x = random.Next(0, 639);
ListaObjetos[n].y = random.Next(0, 479);
// Lo indicamos activo
ListaObjetos[n].activo = true;
}
// Colocamos la bateria
MiBateria.x = random.Next(0, 639);
MiBateria.y = random.Next(0, 479);
MiBateria.activo = true;
maquina.Inicializa(ref ListaObjetos, MiBateria);
}
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 FactoresPrimosNumero_Forms
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button2_Click(object sender, EventArgs e)
{
Application.Exit();
}
private void button1_Click(object sender, EventArgs e)
{
int numero, resi, k;
string cadena = textBox2.Text;
numero = int.Parse(textBox1.Text);
k = 2;
if (!int.TryParse(textBox1.Text, out numero)) numero = -1;
if (numero < 2)
{
MessageBox.Show("Numeros negativos NO. \r\n Superiores a 2 por
favor");
textBox1.Clear();
return;
}
while ((numero != 1))
{
resi = numero % k;
if ((resi == 0))
{
cadena += (k.ToString() + " x ");
textBox2.Text = cadena.Remove(cadena.Length - 2);
numero = numero / k;
}
else
{
k = k + 1;
}
}
PROBABILIDAD POLINOMIAL
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 ProbabilidadBinomial_I
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
Application.Exit();
}
private static long Factorial(long x)
{
if (x <= 1)
return 1;
else
return x * Factorial(x - 1);
}
namespace OrdinalFecha_Forms
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
dia = int.Parse(textBox1.Text);
mes = int.Parse(textBox2.Text);
año = int.Parse(textBox3.Text);
}
return Numerodias;
}
TRIANGULO DE PASCAL
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 TrianguloPascal_III
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
ENCENDIDO DE FOCOS
FACTORIAL
AREA DE UN CIRCULO
SIMULACION DE UN TANQUE
CUATRO SEMAFOROS