Ejemplo n.º 1
0
        private void button9_Click(object sender, EventArgs e)
        {
            EstudioEventArgs estudio = new EstudioEventArgs();

            estudio.nombre    = this.textBox1.Text;
            estudio.direccion = this.textBox2.Text;
            estudio.fecha     = this.textBox3.Text;
            AgregarEstudio(this, estudio);
            MessageBox.Show("Operacion Exitosa!");
            this.Refresh();
        }
Ejemplo n.º 2
0
        private void main_AgregarEstudio(object sender, EstudioEventArgs e)
        {
            Estudio estudio = new Estudio(e.nombre, e.direccion, e.fecha);

            Data.Estudio.Add(estudio);
            using (Stream stream = new FileStream("Data.bin", FileMode.Create, FileAccess.Write, FileShare.None))
            {
                IFormatter formatter = new BinaryFormatter();
                formatter.Serialize(stream, Data);
                stream.Close();
            }
        }