Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
You can’t perform that action at this time.