// View mail details button (like update but read only) private void button5_Click(object sender, EventArgs e) { // Checking if an item (mail) has been selected if (listBox2.SelectedItems.Count > 0) { // Getting every mail added to the first list then filtering them by the selected campaign // finally assigning it to the variable int selectedEmailId = ((List <Email>)listBox2.Tag)[listBox2.SelectedIndex].EmailId; EmailPage ep = new EmailPage(listBox2, selectedEmailId, true); ep.Show(); } else { // popup MessageBox.Show("Select one mail."); } }
// Add mail button private void button8_Click(object sender, EventArgs e) { EmailPage ep = new EmailPage(listBox2, null); ep.Show(); }