private void bnEdit_Click(object sender, EventArgs e)
 {
     if (treeConnections.SelectedNode != null && treeConnections.SelectedNode.Tag is Connection)
       {
     // Edit the connection
     Connection c = (Connection)treeConnections.SelectedNode.Tag;
     EditConnection ec = new EditConnection();
     ec.LoadConnection(c);
     if (ec.ShowDialog() == DialogResult.OK)
     {
       // Since we can't update the tree node thing, we'll just delete and re-create it
       ec.SaveConnection(c);
       treeConnections.Nodes.Remove(treeConnections.SelectedNode);
       TreeNode n = new TreeNode(c.Name);
       n.ImageIndex = 1;
       n.SelectedImageIndex = 1;
       n.Tag = c;
       n.Nodes.Add(loading);
       treeConnections.Nodes.Add(n);
     }
       }
       else
       {
     MessageBox.Show("You must click on a connection in the list below first, if you wish to delete it");
       }
 }
 private void bnEdit_Click(object sender, EventArgs e)
 {
     if (treeConnections.SelectedNode != null && treeConnections.SelectedNode.Tag is Connection)
     {
         // Edit the connection
         Connection     c  = (Connection)treeConnections.SelectedNode.Tag;
         EditConnection ec = new EditConnection();
         ec.LoadConnection(c);
         if (ec.ShowDialog() == DialogResult.OK)
         {
             // Since we can't update the tree node thing, we'll just delete and re-create it
             ec.SaveConnection(c);
             treeConnections.Nodes.Remove(treeConnections.SelectedNode);
             TreeNode n = new TreeNode(c.Name);
             n.ImageIndex         = 1;
             n.SelectedImageIndex = 1;
             n.Tag = c;
             n.Nodes.Add(loading);
             treeConnections.Nodes.Add(n);
         }
     }
     else
     {
         MessageBox.Show("You must click on a connection in the list below first, if you wish to delete it");
     }
 }
        private void bnNew_Click(object sender, EventArgs e)
        {
            EditConnection ec = new EditConnection();

            if (ec.ShowDialog() == DialogResult.OK)
            {
                Connection c = new Connection();
                ec.SaveConnection(c);
                TreeNode n = new TreeNode(c.Name);
                n.ImageIndex         = 1;
                n.SelectedImageIndex = 1;
                n.Tag = c;
                n.Nodes.Add(loading);
                treeConnections.Nodes.Add(n);
                connections.Add(c);
            }
        }
 private void bnNew_Click(object sender, EventArgs e)
 {
     EditConnection ec = new EditConnection();
       if (ec.ShowDialog() == DialogResult.OK)
       {
     Connection c = new Connection();
     ec.SaveConnection(c);
     TreeNode n = new TreeNode(c.Name);
     n.ImageIndex = 1;
     n.SelectedImageIndex = 1;
     n.Tag = c;
     n.Nodes.Add(loading);
     treeConnections.Nodes.Add(n);
     connections.Add(c);
       }
 }