I have a Windows application that takes the data in the textboxes and writes them into a randomly generated text file, kinda keeping logs. Then there is this listbox that lists all these separate log files. The thing I want to do is to have another listbox display the file info of the selected one, the 2nd, 7th, 12th, ..., (2+5n)th lines of the text files that is selected after the button 'list info' is clicked. How is it possible to do this?
My code to update the first listbox is:
private void button2_Click(object sender, EventArgs e)
{
listBox1.Items.Clear();
DirectoryInfo dinfo = new DirectoryInfo(@"C:\Users\Ece\Documents\Testings");
// What type of file do we want?...
FileInfo[] Files = dinfo.GetFiles("*.txt");
// Iterate through each file, displaying only the name inside the listbox...
foreach (FileInfo file in Files)
{
listBox1.Items.Add(file.Name + " " +file.CreationTime);
}
}