using System;
using System.ComponentModel;
using System.Windows.Forms;

namespace _8_5
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private float a;
        private float b;
        private float area;

        private void Form1_Load(object sender, EventArgs e)
        {
            errorProvider1.RightToLeft = true;
            errorProvider1.BlinkStyle = ErrorBlinkStyle.AlwaysBlink;
        }

        private void textBox1_Validating(object sender, CancelEventArgs e)
        {
            try
            {
                a = int.Parse(textBox1.Text);
                errorProvider1.SetError(textBox1, "");
            }
            catch
            {
                errorProvider1.SetError(textBox1, "لطفاً یک مقدار عددی صحیح وارد کنید.");
            }
        }

        private void textBox2_Validating(object sender, CancelEventArgs e)
        {
            try
            {
                b = int.Parse(textBox2.Text);
                errorProvider1.SetError(textBox2, "");
            }
            catch
            {
                errorProvider1.SetError(textBox2, "لطفاً یک مقدار عددی صحیح وارد کنید.");
            }
        }

        private void button1_Click(object sender, EventArgs e)
        {
            area = a * b;
            MessageBox.Show("Area is: " + area);
        }
    }
}