Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private void btnRead_Click(object sender, System.EventArgs e)
- {
- OpenFileDialog ofd = new OpenFileDialog();
- ofd.ShowDialog();
- FileStream fs = new FileStream(ofd.FileName, FileMode.OpenOrCreate);
- StreamReader sr = new StreamReader(fs);
- int lineCount=0;
- while (sr.ReadLine()!=null)
- {
- lineCount++;
- }
- fs.Close();
- MessageBox.Show("There are " + lineCount + " lines in " + ofd.FileName);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement