Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.IO;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Windows.Forms;
- namespace KickAss_Converter
- {
- public partial class Form1 : Form
- {
- public Form1()
- {
- InitializeComponent();
- }
- private void textBox1_TextChanged(object sender, EventArgs e)
- {
- }
- private void otworz_Click(object sender, EventArgs e)
- {
- Stream myStream = null;
- OpenFileDialog openFileDialog1 = new OpenFileDialog();
- openFileDialog1.InitialDirectory = "c:\\";
- openFileDialog1.Filter = "txt files (*.txt)|*.txt|All files (*.*)|*.*";
- openFileDialog1.FilterIndex = 2;
- openFileDialog1.RestoreDirectory = true;
- if (openFileDialog1.ShowDialog() == DialogResult.OK)
- {
- try
- {
- if ((myStream = openFileDialog1.OpenFile()) != null)
- {
- using (myStream)
- {
- plikZrodlowy.Text = openFileDialog1.FileName;
- string linie = File.ReadAllText(plikZrodlowy.Text);
- // Display the file contents by using a foreach loop.
- // System.Console.WriteLine("Contents of WriteLines2.txt = ");
- // foreach (string in linie)
- // {
- // Use a tab to indent each line of the file.
- // Console.WriteLine("\t" + line);
- mojTekst.Text = linie;
- // }
- }
- }
- }
- catch (Exception ex)
- {
- MessageBox.Show("Error: Could not read file from disk. Original error: " + ex.Message);
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement