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 Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            int i;
            grdtable.AllowUserToAddRows = false;
            grdtable.ColumnCount = 5;
            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 = "Résultat";
        }

        private void btnafficher_Click(object sender, EventArgs e)
        {

            int i, nba, nbb, calcule;
            nba = Convert.ToInt32(txtnba.Text);
            nbb = 0;
            
            for (i = 0; i <= 9; i = i + 1)
            {
               
                nbb = nbb + 1;
                calcule = nba * nbb;
                grdtable[0, i].Value = nba;
                grdtable[1, i].Value = "x";
                grdtable[3, i].Value = "=";
                grdtable[2, i].Value = nbb;
                grdtable[4, i].Value = calcule;

                





            }

        }

    }
}
