private void frmDefineODBC_Load(object sender, EventArgs e) { sources = OdbcWrapper.ListODBCsources(); int selectedIndex = -1; foreach (OdbcSource dsn in sources) { int index = comboBoxDSN.Items.Add(dsn.ServerName); if (dsn.ServerName == Config.Sets.Primary_ODBC_DSN) { selectedIndex = index; } } if (selectedIndex >= 0) { comboBoxDSN.SelectedIndex = selectedIndex; } else { comboBoxDSN.Text = Config.Sets.Primary_ODBC_DSN; } textBoxUserName.Text = Config.Sets.Primary_ODBC_User; textBoxPassword.Text = Config.Sets.Primary_ODBC_Pass; UpdateConfigState(Config.State); Config.StateChange += ConfigStateChange; }