Go Back  Xtreme Visual Basic Talk > Legacy Visual Basic (VB 4/5/6) > Interface and Graphics > How to show the selected item in a listview?


Reply
 
Thread Tools Display Modes
  #1  
Old 09-26-2003, 05:51 AM
Coen Coen is offline
Regular
 
Join Date: Sep 2003
Posts: 61
Default How to show the selected item in a listview?


I want to be able to show the selected item in a listview. I'll try to explain by an example.

Visible items:

Item 1
Item 2
Item 3
Item 4

Invisible items:

Item 5
Item 6
Item 7
Item 8

Now when I select Item 8 by the use of source code like this:

listview.listitems(8).selected = true

I want to scroll the listview so that the item becomes visible. So how do I scroll the listview to the selecteditem with source?
Reply With Quote
  #2  
Old 09-26-2003, 06:22 AM
Hypernovean Hypernovean is offline
Freshman
 
Join Date: Jun 2003
Location: Melbourne, Australia
Posts: 26
Default

Use Listview.Listitems(8).EnsureVisible
or Listview.SelectedItem.EnsureVisible

And, from memory, you can't programatically select an item by setting it's Selected property, which is read-only; you need to use
Set Listview.SelectedItem = Listview.ListItems(#)
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
how to get listview selected item? zhujp98 General 1 09-08-2003 03:09 PM
AbsolutePosition from selected item in a ListView GT112 Database and Reporting 3 06-15-2003 08:45 AM
How to fill a listview aording to various combo item selected vivien Database and Reporting 7 12-11-2002 10:50 AM
ListView syntax for no selected item skippy General 3 01-28-2002 01:55 PM
ListView - Selected Item ToolTipText??? Spartan11 General 3 05-04-2001 01:17 AM

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
 
 
-->