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 TP06Ex1_Invitations
{
    public partial class Form1 : Form
    {
        // Déclaration des variables globales au formulaire
        double i;
        string nom;
        string civil;
        int nbpers;
        string affichage;
        int nbperstot;
        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            nbperstot = 0;

            cbocivil.DropDownStyle = ComboBoxStyle.DropDownList;
            cbocivil.Items.Add("M.");
            cbocivil.Items.Add("Mme");
            cbocivil.Items.Add("Mlle");
            cbocivil.Items.Add("M. et Mme");

            for (i= 1; i<=10; i=i+1)
            {
                cbonbpers.Items.Add(i);
                
            }
        }
        
    private void btnajouter_Click(object sender, EventArgs e)
        {
            nbpers = Convert.ToInt32(cbonbpers.SelectedItem);
            civil =Convert.ToString(cbocivil.SelectedItem);
            nom =Convert.ToString(txtnom.Text);

            affichage = civil + " "+nom +" "+ nbpers +" "+ "personnes";
            lstinvite.Items.Add(affichage);
            nbperstot = nbperstot + nbpers;
            lblnbtot.Text = Convert.ToString(nbperstot);





        }

    }
}
