syncing tabpages to listview lines
Some of you may remember that I wrote a program that read in a bunch of lines from a text file, parsed the data on each line, and displayed the results on tab pages, one tab page per line of data. It went something like this:
File:
Code:
Line1 yaddayaddayadda
Line2 blahblahblah
Line3 spamspamspamspam
Then the program would make 3 tab pages and list the data like this:
Tabpage1:
Code:
HEADER Line1
ELEMENT1 yadda
ELEMENT2 yadda
ELEMENT3 yadda
Tabpage2:
Code:
HEADER Line2
ELEMENT1 blah
ELEMENT2 blah
ELEMENT3 blah
Tabpage3:
Code:
HEADER Line3
ELEMENT1 spam
ELEMENT2 spam
ELEMENT3 spam
ELEMENT4 spam
What I would like to do is take each line of data and put it in a listview, then as a tabpage is selected, the corresponding line in the listview would get highlighted. So if I am looking at Tabpage 3, then Line3 would be highlighted.
My problem is that I don't quite know where to begin. Building the listview would not be a big deal. I have to read each line in to parse it anyway, it would only take a line or two of code to throw it in a listview.
My main question is where would I put the code that detects which tab page is selected and highlights the line in the listview? Would this be in the tabcontrol, or what?