Results 1 to 2 of 2

Thread: scroll bar attachment

  1. #1

    Thread Starter
    New Member
    Join Date
    Jan 2000
    Location
    calcutta
    Posts
    1

    Post

    how can we attach a scroll bar with a vb form

  2. #2
    Former Admin/Moderator MartinLiss's Avatar
    Join Date
    Sep 1999
    Location
    San Jose, CA
    Posts
    33,431

    Post

    I assume you mean that you have a long form and you want to be able to scroll the form up and down. Here is one way of doing it. Put a picturebox on the form, and place all your current controls in that picturebox. Add a vertical scroll bar at the very right had side of the form (not in the picturebox). Then add the following code:
    Code:
    Private Sub Form_Load()
        Me.BorderStyle = 1 ' Don't allow the user the expand the form
        Form1.Height = 10000 ' The actual height of the form
        Picture1.Top = 0
        Picture1.Left = 0
        Picture1.Width = Me.Width - (VScroll1.Width + 120)
        Picture1.Height = 13600 ' I don't understand why 10000 doesn't work
                                ' here. In any case, experiment with the height
                                ' so it is the full height of the form.
        VScroll1.Max = Me.Height
        VScroll1.SmallChange = 100
        VScroll1.LargeChange = 4000
        Me.Height = 4000
        VScroll1.Height = Me.ScaleHeight
    End Sub
    
    
    Private Sub VScroll1_Change()
    Picture1.Top = -(VScroll1.Value)
    End Sub
    ------------------
    Marty

    [This message has been edited by MartinLiss (edited 01-05-2000).]

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