Dia Mejor

Practica7

Author: Moises



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 Practica7
{
public partial class Form1 : Form
{
Arreglo A1 = new Arreglo();
int I=0, dato;
public Form1()
{
InitializeComponent();
}

private void Form1_Load(object sender, EventArgs e)
{
label2.Text = ("Escribe el dato " + (I+1));
label2.Visible = true;
label3.Visible = false;
label4.Visible = false;
label5.Visible = false;
label6.Visible = false;
label7.Visible = false;
btAceptar.Visible = false;
btAceptar1.Visible = true;
textBox2.Visible = true;
textBox3.Visible = false;
textBox4.Visible = false;
textBox5.Visible = false;
textBox6.Visible = false;
textBox7.Visible = false;
textBox2.Focus();



}

private void btAceptar1_Click(object sender, EventArgs e)
{

if (I >= 0 && I <10)
{
label2.Text = ("Escribe el dato " + (I+2));
dato = int.Parse(textBox2.Text);
A1.AsignarDato(I, dato);
int posmay = A1.Mayor(10);
textBox3.Text = A1.ObtenerDato(posmay).ToString();
int posmayor = posmay + 1;
textBox4.Text = posmayor.ToString();
int posmen = A1.Menor(10);
textBox5.Text = A1.ObtenerDato(posmen).ToString();
int posmenor = posmen + 1;
textBox6.Text = posmenor.ToString();

listBox1.Items.Add(I + 1 + ". " + dato);
textBox2.Clear();
textBox2.Focus();
I++;


}
if (I == 10)
{
btAceptar1.Visible = false;
textBox2.Visible = false;
label2.Visible = false;
btAceptar.Visible = true;
}
textBox7.Text = A1.Promedio(10).ToString();
}

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

private void btLimpiar_Click(object sender, EventArgs e)
{
I = 0;
label2.Text = ("Escribe el dato " + (I + 1));
label2.Visible = true;
label3.Visible = false;
label4.Visible = false;
label5.Visible = false;
label6.Visible = false;
label7.Visible = false;
btAceptar.Visible = false;
btAceptar1.Visible = true;
textBox2.Visible = true;
textBox3.Visible = false;
textBox4.Visible = false;
textBox5.Visible = false;
textBox6.Visible = false;
textBox7.Visible = false;
textBox2.Focus();
textBox2.Clear();
textBox3.Clear();
textBox4.Clear();
textBox5.Clear();
textBox6.Clear();
textBox7.Clear();
textBox2.Focus();
listBox1.Items.Clear();
}

private void btAceptar_Click(object sender, EventArgs e)
{
I = 0;
label3.Visible = true;
label4.Visible = true;
label5.Visible = true;
label6.Visible = true;
label7.Visible = true;
btAceptar.Visible = true;
textBox3.Visible = true;
textBox4.Visible = true;
textBox5.Visible = true;
textBox6.Visible = true;
textBox7.Visible = true;
btAceptar.Visible = false;
}
}
}

 

0 Response to “Practica7”

Leave a Reply