private void btnAdd_Click(object sender, EventArgs e) { using (var addForm = new AddTaskGUI(this)) { addForm.ShowDialog(); } }
void listBox_MouseDoubleClick(object sender, MouseEventArgs e) { var listBox = (ListBox)sender; var index = listBox.IndexFromPoint(e.X, e.Y); var task = (Task)listBox.Items[index]; if (index != -1) { using (var addForm = new AddTaskGUI(this)) { addForm.ShowDetailTask(task); addForm.ShowDialog(); addForm.Dispose(); } } }