private void overdueItemsGridView_CellContentClick(object sender, DataGridViewCellEventArgs e) { if (e.ColumnIndex == 9 || e.ColumnIndex == 0) { int indexRow = e.RowIndex; if (indexRow >= 0) { DataGridViewRow row = this.overdueItemsGridView.Rows[e.RowIndex]; var borrower = new currentBorrower(); borrower.EmailAddress = row.Cells["BorrowerEmail"].Value.ToString(); EmailHandler emailBorrower = new EmailHandler(borrower.EmailAddress); emailBorrower.Show(); } } }
private void studentGridView_CellContentClick(object sender, DataGridViewCellEventArgs e) //grabs email of row clicked and fills emailhandler form email box { if (e.ColumnIndex == 9 || e.ColumnIndex == 0) { int indexRow = e.RowIndex; if (indexRow >= 0) { DataGridViewRow row = this.studentGridView.Rows[e.RowIndex]; var student = new currentBorrower(); student.EmailAddress = row.Cells["EmailAddress"].Value.ToString(); EmailHandler emailhandler = new EmailHandler(student.EmailAddress); emailhandler.Show(); this.Close(); } } }
private void btnEmails_Click(object sender, EventArgs e) { bool isOpen = false; foreach (Form f in Application.OpenForms) { if (f.Text == "EmailHandler") { isOpen = true; f.BringToFront(); break; } } if (isOpen == false) { EmailHandler emailhandler = new EmailHandler(""); emailhandler.Show(); } }