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

    private void button1_Click(object sender, EventArgs e)
    {
      MessageBox.Show("Witaj świecie!");
    }

    private void button2_Click(object sender, EventArgs e)
    {
      int n = int.Parse(tbRozmiar.Text);
      int[,] M = new int[n, n];

      for (int i = 0; i < n; i++)
        for (int j = 0; j < n; j++)
          M[i, j] = (i + 1) * (j + 1);


      string s = "";
      for (int i = 0; i < n; i++)
      {
        for (int j = 0; j < n; j++)
          //s = s + " " + M[i, j].ToString();
          s = $"{s} {M[i,j],3}";
        s = s + "\r\n";
      }
      label1.Text = s;
      textBox1.AppendText("\r\n\r\n");
      textBox1.AppendText(s);
    }

    private void button3_Click(object sender, EventArgs e)
    {
      if (checkBox1.Checked)
      {
        MessageBox.Show((string)listBox1.SelectedItem);
      }
      else
      {
        MessageBox.Show(comboBox1.Text);
      }
    }

    private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
    {
      MessageBox.Show(comboBox1.Text);
    }
  }
}
