private void btnSave_Click(object sender, EventArgs e) { CLS_ServerSettings Serverconn = new CLS_ServerSettings(); if (cmb_database.SelectedIndex > 0) { if (Serverconn.TestConnection(server, database, uid, pwd, wind) == true) { if (RemeberSettings.Checked == true) { var p = Properties.Settings.Default; p.Server = txtServerName.Text; p.IsWinAuth = rdoWin.Checked; p.uid = txtUser.Text; p.password = txtPass.Text; p.database = database; MessageBox.Show(database); p.Save(); MessageBox.Show("تم الحفظ بنجاح "); } this.DialogResult = DialogResult.OK; this.Close(); } } else { MessageBox.Show("برجاء اختيار قاعدة البيانات "); cmb_database.Focus(); } }
private void btn_test_connection_Click(object sender, EventArgs e) { CLS_ServerSettings s = new CLS_ServerSettings(); if (cmb_database.SelectedIndex < 0) { MessageBox.Show("برجاء اختيار قاعدة البيانات "); cmb_database.Focus(); } else { if (s.TestConnection(server, database, uid, pwd, wind)) { MessageBox.Show("sucess"); } } }