private void Form1_FormClosing(object sender, FormClosingEventArgs e) { dias.Clear(); foreach (Control c in this.Controls) { if (c is CheckBox) { CheckBox cb = (CheckBox)c; if (cb.Checked) { dias.Add(cb.Text);//Talvez esto esta mal } } } guardar g = new guardar(tbHoras.Text, tbMinutos.Text, ruta, archivo, dias);//talvez aqui esta mal int res = g.guardarInt(); }
public void cargar() { string path = Application.StartupPath + @"\settings"; FileStream fs = new FileStream(path, FileMode.OpenOrCreate); try { var binfor = new System.Runtime.Serialization.Formatters.Binary.BinaryFormatter(); guardar g = (guardar)binfor.Deserialize(fs); tbHoras.Text = g.Hora; tbMinutos.Text = g.Min; ruta = g.Ruta; archivo = g.Nombre; dias = g.Dias; foreach (Control c in this.Controls) { if (dias.Count > 0) { for (int i = 0; i < dias.Count; i++) { if (c.Text == dias[i]) { ((CheckBox)c).Checked = true; } } } } song.URL = ruta; song.Ctlcontrols.stop(); lblCancion.Text = archivo; lblCancion.Location = new Point(this.ClientSize.Width / 2 - lblCancion.Width / 2, lblCancion.Location.Y); } catch (Exception ex) { MessageBox.Show(ex.Message); } fs.Close(); }