467,225 Members | 1,368 Online
Bytes | Developer Community
Ask Question

Home New Posts Topics Members FAQ

Post your question to a community of 467,225 developers. It's quick & easy.

List View question

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

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 21 '05 #1
  • viewed: 1168
Share:
5 Replies
Me.lsvListView.SelectedItems(0).EnsureVisible

"Darin" <darin_nospam@nospamever> schreef in bericht
news:uV*************@TK2MSFTNGP15.phx.gbl...
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

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Nov 21 '05 #2
Darin,

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

Kerry Moorman

"Darin" wrote:
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

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Nov 21 '05 #3
"Darin" <darin_nospam@nospamever> schrieb:
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.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

Nov 21 '05 #4
THanks - that worked great.

Darin

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 21 '05 #5
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

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 21 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

8 posts views Thread by Guy Hocking | last post: by
5 posts views Thread by Xah Lee | last post: by
19 posts views Thread by RAJASEKHAR KONDABALA | last post: by
5 posts views Thread by Praveen R | last post: by
90 posts views Thread by Christoph Zwerschke | last post: by
15 posts views Thread by Andrew Brampton | last post: by
2 posts views Thread by Kaur | last post: by
reply views Thread by anna_parkins7@yahoo.co.uk | last post: by
1 post views Thread by Jeff Williams | last post: by
reply views Thread by Adict | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.