/*BtnRafraichir_Click * Permet de rafraîchir le DataGridView*/ private void BtnRafraichir_Click(object sender, EventArgs e) { Dgv_Forum.Rows.Clear(); Users user = new Users(LblUser.Text); int niveau = UsersController.ChargerIdNiveaux(user); int matiere = MatiereController.RecuperationIdMatiere(LblMatiere.Text); List <Envoyer> lesMessages = EnvoyerController.ChargerMessageParMatiere(niveau, matiere); for (int i = 0; i < lesMessages.Count(); i++) { Console.Write(i); Dgv_Forum.Rows.Add(lesMessages[i].objetMessage, lesMessages[i].texteMessage); } Dgv_Forum.DefaultCellStyle.WrapMode = DataGridViewTriState.True; Dgv_Forum.AutoSizeRowsMode = DataGridViewAutoSizeRowsMode.AllCells; }
public ForumEleve(Users user, string nomMatiere) { InitializeComponent(); int niveau = UsersController.ChargerIdNiveaux(user); int matiere = MatiereController.RecuperationIdMatiere(nomMatiere); List <Envoyer> lesMessages = EnvoyerController.ChargerMessageParMatiere(niveau, matiere); for (int i = 0; i < lesMessages.Count(); i++) { Console.Write(i); Dgv_Forum.Rows.Add(lesMessages[i].objetMessage, lesMessages[i].texteMessage); } LblMatiere.Text = nomMatiere; LblUser.Text = user.loginUser; label1.Text = "Bienvenue sur le forum de " + nomMatiere; Dgv_Forum.DefaultCellStyle.WrapMode = DataGridViewTriState.True; Dgv_Forum.AutoSizeRowsMode = DataGridViewAutoSizeRowsMode.AllCells; }