Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Scroll bar in a frame

Status
Not open for further replies.

JoanneA

Technical User
Jul 16, 2004
3
0
0
GB
I am trying to put a scroll bar on a frame which contains a list box, 2 check boxes, and a text box (these controls are in a horizontal line inside the frame). The controls in the frame are in arrays. The number of controls are determined at runtime, by the number of questions that I input from an excel spreadsheet (the questions go into the listbox).

I cannot work out how to be able to scroll down the frame if it is not large enough to fit all of the controls.
 
Hi
I'm not sure that the following is the most efficient way of doing it, but it seems simple enough and works OK.

Inside your visible frame put a picture box, and turn off its border so you can't see it. In the picture box put a another frame, and turn off its border too. Place your controls onto this (2nd) frame.

To scroll the contents of the visible (outer) frame, you use the value from the scroll bar to change the Top position of the 2nd frame within the picture box.

In the VScrollBar_Change event you need to put code similar to this:

fra2nd.Top = -VScroll.Value * (fra2nd.Height - picBox.ScaleHeight) / 100
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top