Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

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???

Proudly a Palestinian

Microsoft ASP.NET MVP

My Blog: wessamzeidan.net

  • Leaders
Posted

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

Posted

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

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...