List View question

D

Darin

I have a listview box in detail view with 100+ items. I can select the
50th item by lstdetail.items(49).selected=true. But, when I do that the
item is selected, but the listview box hasn't scrolled down to where
that line item is.

How do I get the listview box to scroll down to the selected items.

Darin
 
G

Guest

Darin,

The listview control has an EnsureVisible method that should do what you need.

Kerry Moorman
 
H

Herfried K. Wagner [MVP]

Darin said:
How do I get the listview box to scroll down to the selected items.

Call the item's 'EnsureVisible' method or the 'EnsureVisible' method of the
listview control.
 
D

Darin

In addition to this, when the 50th element is selected, that is fine,
but the first element still has a box around it. So, if I select the
50th programmatically, then, when running the program, hit the down
arrow, it moves from element 1 to element 2, even though 50 was
selected.

I need to somehow completely un-select the first element.

My listview has the following properties:

Me.lstCode.FullRowSelect = True
Me.lstCode.Location = New System.Drawing.Point(8, 80)
Me.lstCode.MultiSelect = False
Me.lstCode.Name = "lstCode"
Me.lstCode.Size = New System.Drawing.Size(744, 208)
Me.lstCode.TabIndex = 10
Me.lstCode.View = System.Windows.Forms.View.Details

Darin
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top