Results 1 to 2 of 2

Thread: [RESOLVED] Listview next button

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Feb 2007
    Location
    Malaysia
    Posts
    1,370

    Resolved [RESOLVED] Listview next button

    I have items show in the listview show as report like this

    3109

    3110

    .....

    .....

    When I click at down button, It suppose hight light the 3110 and 3109 remains in its position... the problem is,It move the items 3109 to 3110 when I click the button. I only want to move the highlight not move the items.The record remains at its position. What the problem with this code?

    ' down BUTTON

    Code:
    If ListView1.SelectedItem.Index = ListView1.ListItems.Count Then
    Set ListView1.DropHighlight = ListView1.ListItems(ListView1.ListItems.Count)
    Else
        Set itmx = ListView1.ListItems.Add(ListView1.SelectedItem.Index + 2, , ListView1.SelectedItem.Text)
            itmx.SubItems(1) = ListView1.SelectedItem.SubItems(1)
            itmx.SubItems(2) = ListView1.SelectedItem.SubItems(2)
            itmx.SubItems(3) = ListView1.SelectedItem.SubItems(3)
            itmx.SubItems(4) = ListView1.SelectedItem.SubItems(4)
            itmx.SubItems(5) = ListView1.SelectedItem.SubItems(5)
            itmx.SubItems(6) = ListView1.SelectedItem.SubItems(6)
     
            ListView1.ListItems.Remove (ListView1.SelectedItem.Index)
        Set ListView1.SelectedItem = ListView1.ListItems(ListView1.SelectedItem.Index + 1)
        Set ListView1.DropHighlight = ListView1.SelectedItem
    
    End If
    Attached Images Attached Images  
    Last edited by matrik02; Jun 26th, 2007 at 07:35 AM.

  2. #2
    PowerPoster
    Join Date
    Feb 2006
    Location
    East of NYC, USA
    Posts
    5,691

    Re: Listview next button

    Try this
    Code:
    If ListView1.SelectedItem.Index = ListView1.ListItems.Count Then
    Set ListView1.DropHighlight = ListView1.ListItems(ListView1.ListItems.Count)
    Else
        Set ListView1.SelectedItem = ListView1.ListItems(ListView1.SelectedItem.Index + 1)
        Set ListView1.DropHighlight = ListView1.SelectedItem
    End If
    The most difficult part of developing a program is understanding the problem.
    The second most difficult part is deciding how you're going to solve the problem.
    Actually writing the program (translating your solution into some computer language) is the easiest part.

    Please indent your code and use [HIGHLIGHT="VB"] [/HIGHLIGHT] tags around it to make it easier to read.

    Please Help Us To Save Ana

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width