/// <summary> /// Delete Email from listBox /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void button7_Click(object sender, EventArgs e) { try { using(var objProvider = new MailProvider()) { var objTempEmail = (Email)listBox1.SelectedItem; objProvider.RemoveEmailById(objTempEmail.Id); label18.Text = String.Empty; textBox10.Clear(); textBox9.Clear(); richTextBox3.Clear(); } UpdateListBox1(); } catch(Exception ex) { MessageBox.Show(ex.Message); } }