Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do I programatically scroll through a listview

Status
Not open for further replies.

Wings

Programmer
Feb 14, 2002
247
US
Hi, I have a listview, I want to programatically scan through the captions of the items in it and compare them to an integer. Does any one know how to start doing this?
I then want to scroll to the Item that matches what I'm looking for. However, I could currently be scrolled above or below the item I'm looking for.

Any Advice?
 
do a for statement and start with ListView's item '0' and just go like that. its not hard. Here's some code I quickly pulled out of one of the apps im working on...

/* ViewEvents is my ListView */
for (int j = 0; j <= ViewEvents->Items->Count; j++)
{
if (ViewEvents->Items->Item[j]->Caption == EditBuffer)
{
ViewEvents->Items->BeginUpdate();
/* I added this statement for your sake. i think this is what you want */
if (myInt == StrToInt(ViewEvents->Items->Item[j]->Caption))
ViewEvents->Items->Item[j]->SubItems->Add(&quot;&quot;);
ViewEvents->Items->EndUpdate();

}
} Cyprus
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top