public RegForm() { InitializeComponent(); tm.Tick += timer1_Tick; tm.Interval = 1000; tm.Enabled = true; tm.Start(); RegForm rf = this; SqlConnClass scc = new SqlConnClass(); scc.RegFormLoad(rf); }
public void RegFormLoad(RegForm rf) { string connStr = "server=localhost;user=root;database=pafenov;password="******"SELECT CountryName FROM country"; MySqlCommand command = new MySqlCommand(sql, conn); MySqlDataReader reader = command.ExecuteReader(); while (reader.Read()) { rf.comboBox2.Items.Add(reader[0].ToString()); } reader.Close(); conn.Close(); }