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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How can we scroll listview control forcefully

Status
Not open for further replies.

JawwadLone

Programmer
Joined
Mar 17, 2004
Messages
57
Location
PK
I am working in Visual Basic 6.0. I want to scroll in listview control forcefully, 10 lines up and 10 lines down on pressing up and down arrow keys in a text box. Can any one help me out in this problem?
 
i'm not able to get to my VB right now, but I think there should be a property like listview1.GetFirstVisible. If there is, you should be able to do something like this:

intCount = iif(bUp,10,-10) 'to specify up or down
intRow = Listview1.GetFirstVisible
set ListView1.SelectedItem = Listview1.Listitems(intRow + intCount)
Listview1.SelectedItem.EnsureVisible
ListView1.Refresh

some of the syntax may be off because I think I'm good enough to switch back and forth between C++ and VB and I might be a little mixed up, but you should be able to get the general idea :)

bdiamond
 
Thank you very much ur code rely helped me alot. I used this code to solve my problem.


Set ListView1.SelectedItem = ListView1.ListItems(rec)
ListView1.SelectedItem.EnsureVisible
ListView1.Refresh


where rec is the variable which indicates the current record in listview control.

Thank you once again.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top