private void button3_Click(object sender, EventArgs e) { TrainerForm tform = new TrainerForm(); GetTrainers(tform); tform.setForm(this); tform.ShowDialog(); }
public void GetTrainers(TrainerForm tform) { CN.Open(); SqlCommand cmd = new SqlCommand("PROJETO.GetTreinadores", CN); cmd.CommandType = CommandType.StoredProcedure; SqlDataReader reader = cmd.ExecuteReader(); tform.GetListBox().Items.Clear(); while (reader.Read()) { tform.GetListBox().Items.Add(reader["Nome"] + " | " + " " + reader["Clube"] + " | " + reader["Especializacao"]); } CN.Close(); }