private void btnGuardar_Click(object sender, EventArgs e) { try { FolderBrowserDialog Dialogo = new FolderBrowserDialog(); if (Dialogo.ShowDialog() == DialogResult.OK) { string dato = MiCola.guardarFormato(); string nombreDelArchivo; if (txtNombreArchivo.Text == "") { nombreDelArchivo = "Cola"; } else { nombreDelArchivo = txtNombreArchivo.Text; } string ruta = Dialogo.SelectedPath + "\\" + nombreDelArchivo + ".txt"; using (var writer = new StreamWriter(ruta)) { writer.Close(); } string[] datos = { dato, MiCola.arregloCircular.Length + "" }; File.WriteAllLines(ruta, datos); MessageBox.Show("Datos guardados en la ruta : " + ruta); } } catch { MessageBox.Show("Error al cargar los datos"); } }