[RESOLVED] Problem with Listview EnsureVisible-VBForums
Results 1 to 6 of 6

Thread: [RESOLVED] Problem with Listview EnsureVisible

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Nov 2005
    Posts
    1,832

    Resolved [RESOLVED] Problem with Listview EnsureVisible

    Hi, I have a Listview that contains files (their full paths) and I'm uploading them to a server. When I start uploading a file or it has finished, I'm changing the first SubItem and the SmallIcon of that row.

    I'd like to make the Listview autoscroll to the file/row that is currently uploading, but every time the SmallIcon is changed the Listview refreshes, scrolls to the top and EnsureVisible is ignored.

    I'm using the Listview from Common Controls 5.0.

    vb Code:
    1. lvw.ListItems(HoldListIndex(lIndex)).SubItems(1) = "200 - OK!"
    2. lvw.ListItems(HoldListIndex(lIndex)).SmallIcon = 4 'moves scrollbar to top
    3. lvw.ListItems(HoldListIndex(lIndex)).EnsureVisible 'seems to be ignored/bypassed
    4. GetNextFile Index

  2. #2
    Super Moderator RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,102

    Re: Problem with Listview EnsureVisible

    What if you reverse the order and make ensurevisible the first call?
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Star Wars Gangsta Rap Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel Core 2 Extreme Ed., 2 WD Raptor 10K RPM 300 GB HDs, 2 GBs DDR2 667 MHz RAM, 2 Viewsonic 24" LCDs, Windows 7 SP-1/Windows 8.1, Office 2010, VS 2013

  3. #3

    Thread Starter
    Frenzied Member
    Join Date
    Nov 2005
    Posts
    1,832

    Re: Problem with Listview EnsureVisible

    Unfortunately that doesn't work. The Listview automatically scrolls back to the top every time something is changed in the Listview.

  4. #4
    PowerPoster Fazi's Avatar
    Join Date
    Aug 2005
    Location
    Underworld
    Posts
    2,525

    Re: Problem with Listview EnsureVisible

    Before Ensure Visible line, what about a
    Code:
    .Selected = True
    to the raw ?

  5. #5
    Super Moderator RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,102

    Re: Problem with Listview EnsureVisible

    Do you have sorting on or making a call to sort?
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Star Wars Gangsta Rap Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel Core 2 Extreme Ed., 2 WD Raptor 10K RPM 300 GB HDs, 2 GBs DDR2 667 MHz RAM, 2 Viewsonic 24" LCDs, Windows 7 SP-1/Windows 8.1, Office 2010, VS 2013

  6. #6

    Thread Starter
    Frenzied Member
    Join Date
    Nov 2005
    Posts
    1,832

    Re: Problem with Listview EnsureVisible

    The solution seems to be using ".Selected = True" like Fazi posted above or giving the Listview focus. ".EnsureVisible" works fine then.

    Thanks.

Posting Permissions

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



Featured


Click Here to Expand Forum to Full Width

Survey posted by VBForums.