Created
June 5, 2012 20:52
-
-
Save rogerfor/2877809 to your computer and use it in GitHub Desktop.
leerarchivo
This file contains 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
using System; | |
using System.Collections; | |
using System.Collections.Generic; | |
using System.ComponentModel; | |
using System.Data; | |
using System.Drawing; | |
using System.IO; | |
using System.Linq; | |
using System.Text; | |
using System.Windows.Forms; | |
namespace PruebaXMl | |
{ | |
public partial class Form1 : Form | |
{ | |
public string NombreArchivo; | |
public Form1() | |
{ | |
InitializeComponent(); | |
} | |
public void button1_Click(object sender, EventArgs e) | |
{ | |
openFileDialog1.Filter = "Archivos de texto (*.txt)|*.txt"; | |
openFileDialog1.Title = "Seleccione un archivo"; | |
if (openFileDialog1.ShowDialog() == DialogResult.OK) | |
{ | |
NombreArchivo = openFileDialog1.FileName; | |
} | |
} | |
private void button2_Click(object sender, EventArgs e) | |
{ | |
string[] readText = File.ReadAllLines(NombreArchivo); | |
foreach (string s in readText) | |
{ | |
mostrar.Text = s.ToString(); | |
} | |
char[] delimiterChars = {':'}; | |
string[] words = NombreArchivo.Split(delimiterChars); | |
foreach (string i in words) | |
{ | |
mostrar2.Text= i.ToString(); | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment