private void button2_Click(object sender, EventArgs e) { if (treeView1.SelectedNode.ImageIndex == 0) { SavedRoutes.EditGroupForm form = new SavedRoutes.EditGroupForm(treeView1, true); form.ShowDialog(); } else { SavedRoutes.EditItemForm form = new SavedRoutes.EditItemForm(treeView1); form.ShowDialog(); } }