using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
double lim, peso, sum;
public Form1()
{
InitializeComponent();
sum = 0;
}
private void button2_Click(object sender, EventArgs e)
{
peso = double.Parse(textBox2.Text);
if (sum <>
{
sum = sum + peso;
listBox1.Items.Add("" + peso.ToString());
if (sum > lim)
{
listBox1.Items.Add("El limite ha excedido");
listBox1.Items.Add("EL PESO TOTAL ES " + sum.ToString());
}
if (sum == lim)
{
listBox1.Items.Add("ha llegado al limite");
listBox1.Items.Add("EL PESO TOTAL ES " + sum.ToString());
}
textBox2.Clear();
textBox2.Focus();
}
else
{
textBox2.Enabled = false;
button2.Enabled = false;
}
}
private void button5_Click(object sender, EventArgs e)
{
lim = double.Parse(textBox1.Text);
listBox1.Items.Add("Peso Individual");
textBox1.Enabled = false;
button5.Enabled = false;
textBox2.Focus();
}
private void label1_Click(object sender, EventArgs e)
{
}
private void button3_Click(object sender, EventArgs e)
{
textBox1.Clear();
textBox2.Clear();
listBox1.Items.Clear();
button5.Enabled=true;
textBox1.Enabled = true;
}
private void button4_Click(object sender, EventArgs e)
{
Close();
}
}
}
{
listBox1.Items.Add("El limite ha excedido");
listBox1.Items.Add("EL PESO TOTAL ES " + sum.ToString());
}
if (sum == lim)
{
listBox1.Items.Add("ha llegado al limite");
listBox1.Items.Add("EL PESO TOTAL ES " + sum.ToString());
}
textBox2.Clear();
textBox2.Focus();
}
else
{
textBox2.Enabled = false;
button2.Enabled = false;
}
}
private void button5_Click(object sender, EventArgs e)
{
lim = double.Parse(textBox1.Text);
listBox1.Items.Add("Peso Individual");
textBox1.Enabled = false;
button5.Enabled = false;
textBox2.Focus();
}
private void label1_Click(object sender, EventArgs e)
{
}
private void button3_Click(object sender, EventArgs e)
{
textBox1.Clear();
textBox2.Clear();
listBox1.Items.Clear();
button5.Enabled=true;
textBox1.Enabled = true;
}
private void button4_Click(object sender, EventArgs e)
{
Close();
}
}
}
No hay comentarios:
Publicar un comentario