Hi I need to select a file with a window and read last line of the selected file.
I tried and I created this code at moment that let me select a file and read it all, but I need now to read just last row of the selected file.. Any solution please? Thx
I tried and I created this code at moment that let me select a file and read it all, but I need now to read just last row of the selected file.. Any solution please? Thx
C#:
private async void OpenFileBtn_ClickAsync(object sender, EventArgs e)
{
using(OpenFileDialog ofd = new OpenFileDialog() { Filter = "Text File|*.txt", Multiselect = false })
{
if (ofd.ShowDialog() == DialogResult.OK)
{
using (StreamReader rd = new StreamReader(ofd.FileName))
{
ReaderRichTxtBox.Text = await rd.ReadToEndAsync();
}
}
}
}
Last edited by a moderator: