private void SaveData() { String data = ""; foreach (DataGridViewRow row in programsGrid.Rows) { // Ignore last row if (row.Index == programsGrid.Rows.Count - 1) { break; } String name = row.Cells["gridcolname"].Value.ToString(); String server = row.Cells["gridcolserver"].Value.ToString(); String user = row.Cells["gridcoluser"].Value.ToString(); String password = row.Cells["gridcolpassword"].Value.ToString(); String dbname = row.Cells["gridcoldbname"].Value.ToString(); data += String.Format("{0}<limiter>{1}<limiter>{2}<limiter>{3}<limiter>{4}<limiter1>", name, server, user, password, dbname); } RegistrySupport registry = new RegistrySupport(); if (registry.Write(Settings.PROGRAM_GRID_KEY, data)) { MessageBox.Show("Settings Saved"); this.Close(); } }
private void SaveData() { String data = ""; if (_isAdminconnection) { foreach (DataGridViewRow row in programsGrid.Rows) { // Ignore last row if (row.Index == programsGrid.Rows.Count - 1) { break; } String name = row.Cells["names"].Value.ToString(); String server = row.Cells["server"].Value.ToString(); String directory = row.Cells["directory"].Value.ToString(); String user = row.Cells["user"].Value.ToString(); String password = row.Cells["password"].Value.ToString(); String local = row.Cells["local"].Value.ToString(); String isAbbot = "false"; if (row.Cells["isAbbot"].Value != null) { isAbbot = row.Cells["isAbbot"].Value.ToString(); } String dbname = row.Cells["dbname"].Value.ToString(); data += String.Format("{0}<limiter>{1}<limiter>{2}<limiter>{3}<limiter>{4}<limiter>{5}<limiter>{6}<limiter>{7}<limiter1>", name, server, directory, user, password, local, isAbbot, dbname);//, exe, dbname); } RegistrySupport registry = new RegistrySupport(); if (registry.Write(Settings.PROGRAM_GRID_KEY, data)) { DevComponents.DotNetBar.MessageBoxEx.Show("Settings Saved"); } } else { foreach (DataGridViewRow row in clientgrid.Rows) { // Ignore last row if (row.Index == clientgrid.Rows.Count - 1) { break; } String name = row.Cells[clientname.Name.ToString()].Value.ToString(); String directory = row.Cells[clientdir.Name.ToString()].Value.ToString(); String dbtype = row.Cells[clientdbtype.Name.ToString()].Value.ToString(); data += String.Format("{0}<limiter>{1}<limiter>{2}<limiter1>", name, directory, dbtype); } RegistrySupport registry = new RegistrySupport(); if (registry.Write(Settings.CLIENT_GRID_KEY, data)) { DevComponents.DotNetBar.MessageBoxEx.Show("Settings Saved"); } } }