private void bconnect_Click(object sender, EventArgs e) { TreeNode nnode = FindSelectedNode(); if (nnode == null) { return; } if (nnode.Tag is DatabaseInfo) { DatabaseInfo dbinfo = (DatabaseInfo)nnode.Tag; try { dbinfo.Connect(); dbinfo.DisConnect(); } catch (Exception E) { MessageBox.Show(E.Message); } } }