private void btnAdd_Click(object sender, EventArgs e)
 {
     try
     {
         if (string.IsNullOrWhiteSpace(tbxMilitary.Text))
         {
             errorProviderMilitary.SetError(tbxMilitary, "Add Military Status!");
             return;
         }
         else
         {
             MilitaryStatu military = new MilitaryStatu
             {
                 Name = tbxMilitary.Text
             };
             db.MilitaryStatus.Add(military);
             db.SaveChanges();
             updateInfo();
             clearTxt();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("Please try again after 2 minutes!");
         File.AppendAllText(path, "\n" + ex + ":" + DateTime.Now);
         return;
     }
 }
        private void dgvMilitary_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.RowIndex < 0)
            {
                return;
            }
            int id = (int)dgvMilitary.Rows[e.RowIndex].Cells[0].Value;

            selectedMilitary = db.MilitaryStatus.Where(w => w.ID == id).FirstOrDefault();
            tbxMilitary.Text = selectedMilitary.Name;
            btnAdd.Enabled   = false;
        }