Skip to content

Instantly share code, notes, and snippets.

@rogerfor
Created June 5, 2012 20:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rogerfor/2877809 to your computer and use it in GitHub Desktop.
Save rogerfor/2877809 to your computer and use it in GitHub Desktop.
leerarchivo
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