i'm trying to read the text in a text file. This is my code:
namespace ReadFileTest
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
System.Reflection.Assembly ass = System.Reflection.Assembly.GetExecutingAssembly();
private void button1_Click(object sender, EventArgs e)
{
System.IO.StreamReader myFile = new System.IO.StreamReader(ass.GetManifestResourceStream(@"ReadFileTest.TextFile1.txt"));
while (myFile.Peek() != -1)
{
myFile.ReadLine();
}
string myString = myFile.ReadToEnd();
myFile.Close();
textBox1.Text = myString;
}
}
}