miércoles, 9 de diciembre de 2009

PRACTICA 10.3 WINDOWS

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_10._3_WINDOWS
{
public partial class Form1 : Form
{
int[,] voltaje = new int[3, 5];
int r = 0;
int resistencia = 0;
int corriente = 0;
int c1 = 0, c2 = 0;
public Form1()
{
InitializeComponent();
listBox1.Items.Add("VOLTAJES");
}

private void button1_Click(object sender, EventArgs e)
{
if (resistencia <>
{
if (corriente <>
{
voltaje[resistencia, corriente] = int.Parse(textBox1.Text);
listBox1.Items.Add("Voltaje [" + resistencia.ToString() + "," + corriente.ToString() + "] : " + voltaje[resistencia, corriente].ToString());
corriente++;
textBox1.Clear();
textBox1.Focus();
textBox1.Clear();
}
else
{
resistencia++;
corriente = 0;

}

}
}

private void button2_Click(object sender, EventArgs e)
{
for (resistencia = 0; resistencia <>
{
for (corriente = 0; corriente <>
{
if (voltaje[resistencia, corriente] <>
{
c1 = c1 + 1;

}
else
{
if (voltaje[resistencia, corriente] >= 60)
{
c2 = c2 + 1;
}
}

}
}

label2.Text = ("Numero de Voltajes <60>
label3.Text = ("Numero de Voltases >=60 es: " + c2.ToString());

}

private void label2_Click(object sender, EventArgs e)
{
textBox1.Clear();
textBox1.Focus();
listBox1.Items.Clear();
label2.Text = "";
label3.Text = "";
}

private void label3_Click(object sender, EventArgs e)
{
Close();
}
}
}



No hay comentarios:

Publicar un comentario