Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

Is there a difference between using this code

 

       lvw.Items(index).Selected = True

 

and the classical built-in user event of clicking on an item?

 

It seems so!

Because the row turns all blue, when clicked via mouse, but is greyed when selected via code.

 

Or did I miss something?

 

Any comments greatly appreciated :-)

.nerd
  • Leaders
Posted
i dont think you will highlight the listitem in the same way as clicking it, i think thats a WM_PAINT issue that happens when the mouse goes down, focusing / selecting the item will only highlight it a dull grey colour not dark blue / grey

  • Leaders
Posted

ok i fixed it , i just give it a good test and mine highlights blue at the click of a button :

   Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button6.Click
       ListView1.Focus()
       ListView1.Items(3).Selected = True
       ListView1.Items(3).Focused = True
   End Sub

hope this helps :)

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...