private void dataGridViewEmployees_Info_CellClick(object sender, DataGridViewCellEventArgs e) { if (MessageBox.Show("If you Update? click Yes \nIf Sent Email? click No", "Update/Sent Email", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { try { int i = Convert.ToInt32(dataGridViewEmployees_Info.SelectedCells[0].Value.ToString()); string Name = dataGridViewEmployees_Info.SelectedCells[1].Value.ToString(); string FName = dataGridViewEmployees_Info.SelectedCells[2].Value.ToString(); string MName = dataGridViewEmployees_Info.SelectedCells[3].Value.ToString(); string Gender = dataGridViewEmployees_Info.SelectedCells[5].Value.ToString(); string Department = dataGridViewEmployees_Info.SelectedCells[6].Value.ToString(); string Designation = dataGridViewEmployees_Info.SelectedCells[7].Value.ToString(); string PStatus = dataGridViewEmployees_Info.SelectedCells[9].Value.ToString(); string CStatus = dataGridViewEmployees_Info.SelectedCells[10].Value.ToString(); string PNo = dataGridViewEmployees_Info.SelectedCells[11].Value.ToString(); string Email = dataGridViewEmployees_Info.SelectedCells[12].Value.ToString(); string Address = dataGridViewEmployees_Info.SelectedCells[13].Value.ToString(); Update_Employees ue = new Update_Employees(); ue.ID = i; ue.eName = Name; ue.FName = FName; ue.MName = MName; ue.Gender = Gender; ue.Department = Department; ue.Designation = Designation; ue.PStatus = PStatus; ue.CStatus = CStatus; ue.PNo = PNo; ue.Email = Email; ue.Address = Address; ue.Show(); this.Hide(); } catch (Exception ex) { MessageBox.Show(ex.Message); } } else { string email = dataGridViewEmployees_Info.SelectedCells[12].Value.ToString(); this.Hide(); Sent_Email sm = new Sent_Email(); sm.To = email; sm.Show(); } }
private void emailToolStripMenuItem_Click(object sender, EventArgs e) { Sent_Email sm = new Sent_Email(); sm.Show(); }