Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. listviewgroup troubels

listviewgroup troubels

Scheduled Pinned Locked Moved Visual Basic
questionhelp
2 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    JR212
    wrote on last edited by
    #1

    Hi, I need some help wilt listviewgroups. 1. How can I find the group that I click/dblclick. I tryed with

    Private Sub ListViewCollapsible1_MouseDown(sender As Object, e As MouseEventArgs) Handles ListViewCollapsible1.MouseDown
    Dim lv As ListViewCollapsible = sender
    Dim lvi As ListViewItem = lv.HitTest(e.X, e.Y).Item

    If lvi Is Nothing Then
      For n = 0 To (lv.Font.Size \* 2)
        Dim ht As ListViewHitTestInfo = lv.HitTest(e.X, e.Y + n)
        If ht.Item IsNot Nothing Then
          Dim g As ListViewGroup = ht.Item.Group
          Dim gs As New ListViewGroupState
    
          Dim sTag As String = g.Tag & " "
          If sTag.Contains("collapsed") Then
            lv.SetGroupState(ListViewGroupState.Normal, ht.Item.Group)
            ht.Item.Group.Tag = "Collapsed"
          Else
            lv.SetGroupState(ListViewGroupState.Collapsed, ht.Item.Group)
            ht.Item.Group.Tag = ""
          End If
          Exit For
        End If
      Next
    End If
    

    End Sub

    but when the group is collapsed the code find nothing How can I add an icon to a group? I added an imagelist but groups don't have an imageindex. Jan

    J 1 Reply Last reply
    0
    • J JR212

      Hi, I need some help wilt listviewgroups. 1. How can I find the group that I click/dblclick. I tryed with

      Private Sub ListViewCollapsible1_MouseDown(sender As Object, e As MouseEventArgs) Handles ListViewCollapsible1.MouseDown
      Dim lv As ListViewCollapsible = sender
      Dim lvi As ListViewItem = lv.HitTest(e.X, e.Y).Item

      If lvi Is Nothing Then
        For n = 0 To (lv.Font.Size \* 2)
          Dim ht As ListViewHitTestInfo = lv.HitTest(e.X, e.Y + n)
          If ht.Item IsNot Nothing Then
            Dim g As ListViewGroup = ht.Item.Group
            Dim gs As New ListViewGroupState
      
            Dim sTag As String = g.Tag & " "
            If sTag.Contains("collapsed") Then
              lv.SetGroupState(ListViewGroupState.Normal, ht.Item.Group)
              ht.Item.Group.Tag = "Collapsed"
            Else
              lv.SetGroupState(ListViewGroupState.Collapsed, ht.Item.Group)
              ht.Item.Group.Tag = ""
            End If
            Exit For
          End If
        Next
      End If
      

      End Sub

      but when the group is collapsed the code find nothing How can I add an icon to a group? I added an imagelist but groups don't have an imageindex. Jan

      J Offline
      J Offline
      JR212
      wrote on last edited by
      #2

      Never mind. I was working with an convert from C# what was working except the questions above but forgot 1 line :)

      lvLijst.SetGroupState(ListViewGroupState.Collapsible)

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups