//

        private void btnHakuKur_Click(object sender, EventArgs e)
        {
            if (tbKr.Text != "")
            {
                tbKr.Text = KrVar;
                KrListForm krListForm = new KrListForm(Kurssit, KrVar, KridC, KrAlt);
                KrVar = krListForm.KrVar;
                krListForm.ShowDialog();
                this.Show();
                try
                {
                    gbKr.Enabled      = true;
                    gbKoeHaku.Enabled = true;
                    var Sk = krListForm.SelectedKurssi;
                    populateFormKr(Sk);
                }
                catch
                {
                    gbKr.Enabled      = false;
                    gbKoeHaku.Enabled = false;
                }
            }
            else
            {
                MessageBox.Show("Haku on tyhjä!", "Virhe", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
 private void btnHakuKur_Click(object sender, EventArgs e)
 {
     if (tbKr.Text != "")
     {
         tbOp.Text = SukuVar;
         KrListForm opListForm = new KrListForm(Opiskelijat, SukuVar, idChecker, Alt);
         SukuVar = opListForm.SukuVar;
         opListForm.ShowDialog();
         this.Show();
         try
         {
             gbKr.Enabled      = true;
             gbKoeHaku.Enabled = true;
             var So = opListForm.SelectedOpiskelija;
             populateForm(So);
         }
         catch
         {
             gbKr.Enabled      = false;
             gbKoeHaku.Enabled = false;
         }
     }
     else
     {
         MessageBox.Show("Haku on tyhjä!", "Virhe", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
        //

        private void btnHakuKur_Click(object sender, EventArgs e)
        {
            if (tbKr.Text != "")
            {
                tbKr.Text = KrVar;
                KrListForm krListForm = new KrListForm(Kurssit, KrVar, KridC, KrAlt);
                KrVar = krListForm.KrVar;
                krListForm.ShowDialog();
                this.Show();
                try
                {
                    gbKr.Enabled      = true;
                    gbKoeHaku.Enabled = true;
                    var Sk = krListForm.SelectedKurssi;
                    populateFormKr(Sk);
                    //
                    gbKoe.Enabled       = false;
                    lbKoID.Text         = "Kokeen ID";
                    lbVID.Text          = "Vastaus ID";
                    tbKoeNimi.Text      = null;
                    tbKoeNimi.ReadOnly  = true;
                    tbKoeNimi.BackColor = SystemColors.Control;
                    tbOpett.Text        = null;
                    tbOpett.ReadOnly    = true;
                    tbOpett.BackColor   = SystemColors.Control;
                    tbVaik.Text         = null;
                    tbVaik.ReadOnly     = true;
                    tbVaik.BackColor    = SystemColors.Control;
                    tbKieli.Text        = null;
                    tbKieli.ReadOnly    = true;
                    tbKieli.BackColor   = SystemColors.Control;
                    tbPvm.Text          = null;
                    tbPvm.ReadOnly      = true;
                    tbPvm.BackColor     = SystemColors.Control;
                    tbTPO.Text          = null;
                    tbTPO.ReadOnly      = true;
                    tbTPO.BackColor     = SystemColors.Control;
                    tbSPO.Text          = null;
                    tbSPO.ReadOnly      = true;
                    tbSPO.BackColor     = SystemColors.Control;
                }
                catch
                {
                    gbKr.Enabled      = false;
                    gbKoeHaku.Enabled = false;
                    //
                    gbKoe.Enabled       = false;
                    lbKoID.Text         = "Kokeen ID";
                    lbVID.Text          = "Vastaus ID";
                    tbKoeNimi.Text      = null;
                    tbKoeNimi.ReadOnly  = true;
                    tbKoeNimi.BackColor = SystemColors.Control;
                    tbOpett.Text        = null;
                    tbOpett.ReadOnly    = true;
                    tbOpett.BackColor   = SystemColors.Control;
                    tbVaik.Text         = null;
                    tbVaik.ReadOnly     = true;
                    tbVaik.BackColor    = SystemColors.Control;
                    tbKieli.Text        = null;
                    tbKieli.ReadOnly    = true;
                    tbKieli.BackColor   = SystemColors.Control;
                    tbPvm.Text          = null;
                    tbPvm.ReadOnly      = true;
                    tbPvm.BackColor     = SystemColors.Control;
                    tbTPO.Text          = null;
                    tbTPO.ReadOnly      = true;
                    tbTPO.BackColor     = SystemColors.Control;
                    tbSPO.Text          = null;
                    tbSPO.ReadOnly      = true;
                    tbSPO.BackColor     = SystemColors.Control;
                }
            }
            else
            {
                MessageBox.Show("Haku on tyhjä!", "Virhe", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }