Page 705 - IT2
P. 705

comboBox1.Items.Add("Appartement");
                                       comboBox1.Items.Add("Maison");



                      2.  le code du bouton "Nouveau » :

                      textBox1.Text = "";
                           textBox2.Text = "";
                           textBox3.Text = "";
                           comboBox1.Text = "";
                      textBox4.Text = "";




                      3.   le code du bouton " Ajouter» :


                      dataGridView1.Rows.Add(textBox1.Text, textBox2.Text,
                      textBox3.Text,comboBox1.Text, textBox4.Text );

                      4.  le code du bouton " Supprimer» :


                      if (MessageBox.Show( "voulez vous
               supprimer?","Suppression",MessageBoxButtons.YesNo) == DialogResult.Yes)
                           {
                               foreach (DataGridViewRow dr in dataGridView1.Rows)
                               {
                                   if (dr.Cells[0].Value.ToString() == textBox1.Text)
                                   {
                                       dataGridView1.Rows.Remove(dr);
                                       break;
                                   }
                               }
                           }







                          5. le code du bouton " Sauvegarder» :

               .BinaryFormatter f = new BinaryFormatter();
               FileStream fs = new FileStream("Logements.dat", FileMode.OpenOrCreate,
               FileAccess.Write);
               f.Serialize(fs, Logements);
               fs.Close();



                     Filière                    Epreuve                        Session             10/10
                       DI                 Synthèse V2(Correction)            Juillet 2015
   700   701   702   703   704   705   706   707   708   709   710