private void addATaskToolStripMenuItem_Click(object sender, EventArgs e) { ToolStripItem menuItem = sender as ToolStripItem; ContextMenuStrip owner = menuItem.Owner as ContextMenuStrip; TextBox textBox = owner.SourceControl as TextBox; AddTaskForm addTaskForm = new AddTaskForm(textBox.Name); addTaskForm.ShowDialog(); }
private void viewToolStripMenuItem_Click(object sender, EventArgs e) { ToolStripItem menuItem = sender as ToolStripItem; ContextMenuStrip owner = menuItem.Owner as ContextMenuStrip; TextBox textBox = owner.SourceControl as TextBox; Panel panel = textBox.Parent as Panel; StoryTask task = JoScrum.GetTask(panel.Name, textBox.Name); AddTaskForm addTaskForm = new AddTaskForm(task); addTaskForm.ShowDialog(); }