private void BtnGuardar_Click(object sender, EventArgs e) { SaveFile = new SaveFileDialog(); SaveFile.Filter = "txt files (*.txt)|*.txt"; SaveFile.DefaultExt = "txt"; SaveFile.Title = "Guardar Archivo DFD"; SaveFile.ShowDialog(); // If the file name is not an empty string open it for saving. if (SaveFile.FileName != "") { ValoresGlobales.valores().elementoRaiz = ucdfd1.ObtenerRaiz(); GuardarCargarDFD guardar = new GuardarCargarDFD(); guardar.GuardarArchivo(SaveFile.FileName); } }
private void button2_Click_2(object sender, EventArgs e) { OpenFile = new OpenFileDialog(); OpenFile.Filter = "txt files (*.txt)|*.txt"; OpenFile.FilterIndex = 2; if (OpenFile.ShowDialog() == DialogResult.OK) { try { ValoresGlobales.valores().elementoRaiz = ucdfd1.ObtenerRaiz(); GuardarCargarDFD guardar = new GuardarCargarDFD(); ucdfd1.CargarDFD(guardar.Leer(OpenFile.FileName)); } catch (Exception ex) { MessageBox.Show("Error No se logro abrir el archivo deseado probablemente el formato no es el adecuado"); } } }