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 TP09_TablesMult
{
    public partial class Form2 : Form
    {
        public Form2()
        {
            InitializeComponent();
        }

        private void Form2_Load(object sender, EventArgs e)
        {
            int i;
            grdtable.AllowUserToAddRows = false;
            grdtable.ColumnCount = 7;
            grdtable.RowCount = 10;
            grdtable.RowHeadersVisible = false;
            grdtable.DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
            for (i = 0; i < grdtable.ColumnCount; i++)
            {
                grdtable.Columns[i].Width = 80;
            }
            grdtable.Columns[0].HeaderText = "NbA";
            grdtable.Columns[1].HeaderText = "";
            grdtable.Columns[2].HeaderText = "NbB";
            grdtable.Columns[3].HeaderText = ""; 
            grdtable.Columns[4].HeaderText = "?";
            grdtable.Columns[5].HeaderText = "Résultat";
            grdtable.Columns[6].HeaderText = "";
        }

        private void btnafficher_Click(object sender, EventArgs e)
        {
            int i, nba, nbb;

        }

        private void btncorriger_Click(object sender, EventArgs e)
        {
            int i, nba, nbb, nbuti, result, calcule;
            nba = Convert.ToInt32(txtnba.Text);
            nbb = 0;
            
            for (i = 0; i <= 9; i = i + 1)
            {

                nbb = nbb + 1;
                calcule = nba * nbb;

                
                
               
                grdtable[4, i].Value = calcule;



                grdtable[5, i].Value = calcule;
                
                nbuti = Convert.ToInt32(grdtable[4,i].Value);

                if (calcule == nbuti)
                {
                    grdtable[6, i].Value = "juste";
                }
                else
                {
                    grdtable[6, i].Value = "faux";
                }
            






                }
        }

    }
}
