Created
May 27, 2015 16:51
-
-
Save Trochito/8f3ee12a4c755ec3daf3 to your computer and use it in GitHub Desktop.
Manejo de Archivos con Formularios en C# - básico 1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // WINDOWS FORMS | |
| //CREAR UN ARCHIVO | |
| private void buttonAccion_Click(object sender, EventArgs e) | |
| { | |
| StreamWriter Archivo; | |
| Archivo = File.CreateText(textBoxNomArchivo.Text); | |
| Archivo.Close(); | |
| MessageBox.Show("El archivo ha sido creado correctamente"); | |
| } | |
| //ADICIONAR UNA FILA EN UN ARCHIVO | |
| private void button2_Click(object sender, EventArgs e) | |
| { | |
| StreamWriter Archivo; | |
| Archivo = File.AppendText(textBoxNomArchivo.Text); | |
| Archivo.WriteLine(textBox1.Text); | |
| Archivo.Close(); | |
| MessageBox.Show("La línea ha sido adicionada correctamente!!"); | |
| } | |
| //ELIMINAR UN ARCHIVO | |
| private void button3_Click(object sender, EventArgs e) | |
| { | |
| File.Delete(textBoxNomArchivo.Text); | |
| MessageBox.Show("El archivo ha sido correctamente eliminado!!"); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment