Select automatically an item in a ListView 
Author Message
 Select automatically an item in a ListView

Hi,

I need to select the first item in a listview each time i fill it with a
DataReader.
I tried "If ListView1.Items.Count then
ListView1.Items.Item(1).Selected=True", but it didn't work.
(It was with VB6).

Any idea ?

Thanks.



Wed, 30 Nov 2005 19:44:08 GMT  
 Select automatically an item in a ListView
Hi,

        Here is how to select an item in a listview.
ListView2.Items(1).Selected = True

ListView2.Focus()

Ken

-------------


Quote:
> Hi,

> I need to select the first item in a listview each time i fill it with a
> DataReader.
> I tried "If ListView1.Items.Count then
> ListView1.Items.Item(1).Selected=True", but it didn't work.
> (It was with VB6).

> Any idea ?

> Thanks.



Wed, 30 Nov 2005 20:07:14 GMT  
 Select automatically an item in a ListView
Hello,


Quote:
> I need to select the first item in a listview each time i fill it with a
> DataReader.
> I tried "If ListView1.Items.Count then
> ListView1.Items.Item(1).Selected=True", but it didn't work.
> (It was with VB6).

\\\
ListView1.HideSelection = False
.
.
.
ListView1.Items(1).Selected = True
ListView1.EnsureVisible(ListView1.Items(1))
///

Regards,
Herfried K. Wagner
--
http://www.mvps.org/dotnet



Wed, 30 Nov 2005 20:15:50 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. jump listview to the hilight item (selected item)...

2. Why does the previous selected item in a ListView get selected for a short moment

3. ListView control - Keeping selected items looking selected

4. automatically scrolling a listbox down to the first selected item

5. Listview automatically selects

6. ListView Control - Removing selected items from the list

7. List of selected items in a listview

8. ListView - How to programatically select an item

9. How to select all items in a ListView (searching for a faster way)

10. List of selected items in a listview

11. How to iterate through and delete mutiple selected items from a listview

12. index from selected item in ListView

 

 
Powered by phpBB® Forum Software