suma


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

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

private void btnsuma_Click(object sender, EventArgs e)
{
int resultado;
resultado = Convert.ToInt32(this.txtnro1.Text) + Convert.ToInt32(this.txtnro2.Text);
this.txtrespuesta.Text = Convert.ToString(resultado);
txtnro1.SelectAll();
txtnro1.Focus();
}

private void txtnro1_KeyPress(object sender, System.Windows.Forms.KeyPressEventArgs e)
{
if (e.KeyChar == 13)
{
txtnro2.SelectAll();
txtnro2.Focus();
txtnro2.Text = "";
txtrespuesta.Text = "";
}
}

private void txtnro2_KeyPress(object sender, System.Windows.Forms.KeyPressEventArgs e)
{
if (e.KeyChar == 13)
this.btnsuma.Focus();
}


}
}
  • Digg
  • Del.icio.us
  • StumbleUpon
  • Reddit
  • Twitter
  • RSS

0 Response to "suma"

Publicar un comentario

Buscar en este blog