wessamzeidan Posted March 3, 2004 Posted March 3, 2004 Hi, I have 2 listviews on a form, both views are set to Detail. I need to select items from both lists. I'm able to select elements from both lists but the problem is that when I select an item from one list and then select an item from another list, the blue mark on the selected item in the first list disappears, and appears on the selected item in the second list. What I want is when I select the item in the second list, the item in the first list remains highlighted..... Any suggestions??? Quote Proudly a Palestinian Microsoft ASP.NET MVP My Blog: wessamzeidan.net
Leaders dynamic_sysop Posted March 3, 2004 Leaders Posted March 3, 2004 do this ... Private Sub ListView1_Validated(ByVal sender As Object, ByVal e As System.EventArgs) Handles ListView1.Validated ListView1.HideSelection = False Dim lvi As ListViewItem For Each lvi In ListView1.SelectedItems lvi.Focused = True '/// keep the item highlighted if it's selected Next End Sub Private Sub ListView2_Validated(ByVal sender As Object, ByVal e As System.EventArgs) Handles ListView2.Validated ListView2.HideSelection = False Dim lvi As ListViewItem For Each lvi In ListView2.SelectedItems lvi.Focused = True '/// keep the item highlighted if it's selected Next End Sub Quote
sjn78 Posted March 3, 2004 Posted March 3, 2004 You can set the HideSelection property to False. Only thing is that when the control loses focus, it changes your selected item colour to the control colour and not stay blue (Thats is your system colours are standard) You may be able to override this by code, I'm not sure haven't tried. *EDIT dynamic_sysop's post wan't there when I wrote mine!! lol Quote
wessamzeidan Posted March 3, 2004 Author Posted March 3, 2004 Thanks alot, it worked. But there's a problem, the highlighted item doesn't remain blue, it gets highlighted but with a different color.... Quote Proudly a Palestinian Microsoft ASP.NET MVP My Blog: wessamzeidan.net
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.