Results 1 to 5 of 5

Thread: [RESOLVED] VScrollBar Issue

  1. #1

    Thread Starter
    Fanatic Member AccessShell's Avatar
    Join Date
    Oct 2013
    Posts
    790

    Resolved [RESOLVED] VScrollBar Issue

    I have 2 programs with a VScrollBar. They both have the same scrolling code.
    The first program was last updated 9/1/20. It has always worked correctly, including today.
    The second program is currently being developed. It worked correctly since this code was added. Today it does not work. I get an automation error 438 "Object doesn't support this property or method".

    Here is the code. The highlighted code is where the error occurred.
    Code:
    Private Sub VScroll_Change()
    
    
        ScrollFrame
        
    End Sub
    
    
    Private Sub VScroll_Scroll()
    
    
        ScrollFrame
    
    
    End Sub
    
    
    Private Sub ScrollFrame()
    Dim ctl As Control
    
    
       For Each ctl In Me.Controls
          If ctl.Container.Name = "fraScroll" Then
                ctl.Top = ctl.Top + (oldPos - VScroll.Value)
          End If
       Next
    
    
       oldPos = VScroll.Value
       
    End Sub
    Thanks

  2. #2
    PowerPoster Arnoutdv's Avatar
    Join Date
    Oct 2013
    Posts
    5,872

    Re: VScrollBar Issue

    I assume not each control in the collection has an Container property

    But if you only want to use control fraScroll then why not directly set it's properties?
    Code:
    Private Sub ScrollFrame()
      fraScroll.Top = fraScroll.Top + (oldPos - VScroll.Value)
      oldPos = VScroll.Value
    End Sub

  3. #3
    The Idiot
    Join Date
    Dec 2014
    Posts
    2,721

    Re: VScrollBar Issue

    the reason is that u have a component in your form that doesn't have .Name

    but, as Arnoutdv wrote, if you just want to move fraScroll, u don't need For Each,
    and if you have an array, u can use a For i = Lbound to UBound

  4. #4

    Thread Starter
    Fanatic Member AccessShell's Avatar
    Join Date
    Oct 2013
    Posts
    790

    Re: VScrollBar Issue

    Wow. It was that simple. Thanks Arnoutdv.

  5. #5

    Thread Starter
    Fanatic Member AccessShell's Avatar
    Join Date
    Oct 2013
    Posts
    790

    Re: [RESOLVED] VScrollBar Issue

    Got it baka

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