Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Windows.Forms;
- namespace DeLunaFabio_es01Vettori
- {
- public partial class Form1 : Form
- {
- const int N = 5;
- int[] vet = new int[N];
- int i = 0;
- public Form1()
- {
- InitializeComponent();
- }
- private void btnInserisci_Click(object sender, EventArgs e)
- {
- vet[i] = Convert.ToInt32(txtEta.Text);
- i++;
- txtEta.Text = "";
- txtEta.Focus();
- if (i == N)
- {
- MessageBox.Show("Hai raggiunto il numero degli elementi necessari");
- btnVisualizza.Enabled = true;
- lstEta.Visible = true;
- }
- }
- private void btnCalcola_Click(object sender, EventArgs e)
- {
- for (i = 0; i < N; i++)
- {
- lstEta.Items.Add(vet[i]);
- }
- }
- private void Form1_Load(object sender, EventArgs e)
- {
- btnVisualizza.Enabled = false;
- lstEta.Visible= false;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement