Heiko Posted June 13, 2003 Posted June 13, 2003 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 :-) Quote .nerd
spebola Posted June 13, 2003 Posted June 13, 2003 Does the listview have the focus when the row is greyed? Quote
Heiko Posted June 13, 2003 Author Posted June 13, 2003 Yes. There's a lvw.Focus() call in the previous line of code. :-( Quote .nerd
*Gurus* divil Posted June 13, 2003 *Gurus* Posted June 13, 2003 If the listview is focused this problem shouldn't arise. Try setting the FocusedItem property as well as making that item selected. Quote MVP, Visual Developer - .NET Now you see why evil will always triumph - because good is dumb. My free .NET Windows Forms Controls and Articles
Leaders dynamic_sysop Posted June 14, 2003 Leaders Posted June 14, 2003 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 Quote
Heiko Posted June 16, 2003 Author Posted June 16, 2003 So. Who of you is right? :-) I still can't get it appear in blue. Quote .nerd
Leaders dynamic_sysop Posted June 16, 2003 Leaders Posted June 16, 2003 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 :) Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.