miércoles, 28 de octubre de 2009

Practica 8.2 c) Visual



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_8_2_W_c
{
public partial class Form1 : Form
{
int[] Emax = new int[10];
int I, menor, pos = 0;
public Form1()
{
InitializeComponent();
I = 0;
listBox1.Items.Add("Valores enteros:");

}

private void Form1_Load(object sender, EventArgs e)
{

}

private void button1_Click(object sender, EventArgs e)
{

if (I < 10)
{


Emax[I] = int.Parse(textbox1.Text);
if (I == 0)
{


menor = Emax[0];
}
textbox1.Clear();
textbox1.Focus();

listBox1.Items.Add(I.ToString() + ":\t" + Emax[I].ToString());

if (Emax[I] < menor)
{
menor = Emax[I];
pos = I;
}

I++;
}

else
{
button1.Enabled = false;
}

}



private void button3_Click(object sender, EventArgs e)
{
textbox1.Clear();
listBox1.Items.Clear();
button1.Enabled = true;
}

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

private void button2_Click_1(object sender, EventArgs e)
{
MessageBox.Show("El valor minimo es: " + menor.ToString() + "\nPosicion numero: " + pos.ToString());
}
}
}

No hay comentarios:

Publicar un comentario