Solved

Scrollbar

Posted on 1998-06-04
3
254 Views
Last Modified: 2010-05-03
I need help to make the form height more than the screen height and use scrollbar to scroll through the form.
0
Comment
Question by:mathiv
  • 2
3 Comments
 
LVL 1

Expert Comment

by:JayMerritt
ID: 1462545
Break your long form up into multiple forms, each the desired height for presentation.

Use the scroll bar to SHOW the previous or next form.

0
 
LVL 6

Accepted Solution

by:
clifABB earned 50 total points
ID: 1462546
Basically, you don't really want the form to be bigger than the screen (you might think you do, but you don't).

What you want to do is place a picturebox on your form.  Size it to the maximum size you will need.  Set the BorderStyle property to False.  Move all the controls that are on the form (except the picturebox, of course) to the picturebox.
Now, add a scrollbar to the form and align it next to the picturebox.

In the form's resize event, place this code:
Private Sub Form_Resize()

  VScroll1.Move Me.ScaleWidth - VScroll1.Width, 0, VScroll1.Width, Me.ScaleHeight
  VScroll1.Max = Picture1.Height - Me.ScaleHeight
  If VScroll1.Max < 0 Then
    VScroll1.Max = 0
  End If
  VScroll1.LargeChange = Me.ScaleHeight
  VScroll1.SmallChange = Me.ScaleHeight / 10
End Sub

In the scrollbar's change event, place this code:
Private Sub VScroll1_Change()

  Picture1.Top = VScroll1.Value * -1
End Sub

Note:  The above code will work for vertical only (which is what you requested).  To add horizontal scrolling, add a horizontal scrollbar to the form.
Add the following code to the form load event:
Private Sub Form_Resize()

  VScroll1.Move Me.ScaleWidth - VScroll1.Width, 0, VScroll1.Width, Me.ScaleHeight - HScroll1.Height
  VScroll1.Max = Picture1.Height - Me.ScaleHeight
  If VScroll1.Max < 0 Then
    VScroll1.Max = 0
  End If
  VScroll1.LargeChange = Me.ScaleHeight
  VScroll1.SmallChange = Me.ScaleHeight / 10

  HScroll1.Move 0, Me.ScaleHeight - HScroll1.Height, Me.ScaleWidth - VScroll1.Width, HScroll1.Height
  HScroll1.Max = Picture1.Width - Me.ScaleWidth
  If HScroll1.Max < 0 Then
    HScroll1.Max = 0
  End If
  HScroll1.LargeChange = Me.ScaleWidth
  HScroll1.SmallChange = Me.ScaleWidth / 10
End Sub

Add the following code to the vertical scrollbar change event:
Private Sub VScroll1_Change()

  Picture1.Top = VScroll1.Value * -1
End Sub

Add the following code to the horizontal scrollbar change event:
Private Sub HScroll1_Change()

  Picture1.Left = HScroll1.Value * -1
End Sub

0
 
LVL 6

Expert Comment

by:clifABB
ID: 1462547
That having been said...
I would now suggest, if you have more controls than you have screen, you should use a tabbed screen instead.
0

Featured Post

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

813 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now