private void editToolStripMenuItem_Click(object sender, EventArgs e) { if (lbConnections.SelectedItem != null) { var frm = new ManageConnectionForm { txtName = { Text = lbConnections.SelectedItem.ToString() }, txtConnectionString = { Text = _mConnectionString } }; switch (frm.ShowDialog()) { case DialogResult.OK: // update _dbUtil = new MyDatabaseUtil(frm.txtConnectionString.Text); RefreshConnectionDropDown(); RefreshList(); break; case DialogResult.Abort: // delete _mConnectionString = string.Empty; RefreshConnectionDropDown(); RefreshList(); break; } } }
private void lbConnections_SelectedIndexChanged(object sender, EventArgs e) { if (lbConnections.SelectedItem != null) { var currentCursor = Cursor.Current; Cursor.Current = Cursors.WaitCursor; _mConnectionString = XmlConfig.Instance.GetValue("//MyConnectionStrings//add[@key='" + lbConnections.SelectedItem + "']"); _dbUtil = new MyDatabaseUtil(_mConnectionString); RefreshList(); Cursor.Current = currentCursor; chkSelectAll.Checked = false; } }