For Programmers: Free Programming Magazines  


Home > Archive > Visual Basic > June 2006 > simple listview question









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author simple listview question
Jim@aol.com

2006-06-25, 9:56 pm

How do programmatically select a row in a listview to duplicate the
way it would look if I single clicked the row The Follwoing code
select the row but does not make it look the same as if I clicked it

With lvwQuickEntry
.FullRowSelect = True
.ListItems(5).Selected = True
End With



Larry Rebich

2006-06-25, 9:56 pm

lvwQuickEntry.setfocus

<Jim@aol.com> wrote in message
news:v8ku9259l9hp815sbld4s3ptna4021jmgi@
4ax.com...
> How do programmatically select a row in a listview to duplicate the
> way it would look if I single clicked the row The Follwoing code
> select the row but does not make it look the same as if I clicked it
>
> With lvwQuickEntry
> .FullRowSelect = True
> .ListItems(5).Selected = True
> End With
>
>
>



MikeD

2006-06-26, 6:56 pm


<Jim@aol.com> wrote in message
news:v8ku9259l9hp815sbld4s3ptna4021jmgi@
4ax.com...
> How do programmatically select a row in a listview to duplicate the
> way it would look if I single clicked the row The Follwoing code
> select the row but does not make it look the same as if I clicked it
>
> With lvwQuickEntry
> .FullRowSelect = True
> .ListItems(5).Selected = True
> End With



It'd help if you described what's not the same. Other than the ListView
possibly not having focus (so it might not show as highlighted) or the
ListItem not having the focus rectangle, I don't know what you could mean.
For the former, set the HideSelection property to False. This will show the
hightlighted item even if the ListView doesn't have focus, but the highlight
will be a different color than if the ListView had focus. For the latter,
try setting the SelectedItem property to the ListItem object:

Set lvwQuickEntry.SelectedItem = lvwQuickEntry.ListItems(5)

Generally, you only use the Selected property of a ListItem when
mulitselection is enabled and even then the first ListItem selected should
be done by setting SelectedItem.

--
Mike
Microsoft MVP Visual Basic

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com