Scrollbar in Form

03-05-2003, 08:15 PM
I have a form which is very long. I want to put a scrollbar so i can scroll through the form. how can i make it appear automatically when needed? pls show me in details.

03-05-2003, 09:57 PM
I would not recommend using a scrollbar on a form. The form should be redesigned so it all fits on the screen.

04-05-2003, 01:01 PM
What about if the form cannot be redesigned to fit on the screen, is there any way that a scroll bar can be used?

04-05-2003, 09:46 PM
I've never seen a form that can't be redesigned, but yes it can be done. There have been plenty of posts showing how to do it. It would involve changing the Top properties of all the controls in the control's Change or Scroll event. Attached is a sample.

04-05-2003, 10:03 PM
Thanx, i appreciate the help

04-07-2003, 12:51 PM
The best way would be to put all the controls on a borderless frame (except the scrollbar) so that you only have to one control to alter the Top property of. You might also want to consider grouping the controls in frames and allowing frames to be collapsed/rearranged like the dialogs in 3dsmax to save space, as you rarely need all the controls all at once.

04-07-2003, 01:00 PM
I don't think that'll work. There are too many controls, frames, etc to move onto a borderless frame. If i could just drop a frame onto the form and everything moves into it, then that would work. Unless there's some way to do that, ur suggestion doesn't work.

04-07-2003, 01:10 PM
Is there a reason you can't just select all of the controls on the form, cut them, drop the frame onto the form and paste the cut controls into it? This is a fairly easy task - just use the Edit | Select All menu item (or Ctrl+A).

04-07-2003, 01:19 PM
actually yeah, there is a reason; cause i was an idiot and didn't think of that :) and actually Machaira, i've had a little problem with ur code that u attached the other day. Every time i try and use it in the big form, it comes back with a
Run-Time Error '393':
'Top' property cannot be read at run time

Then, when i go to check on what the bug is, VB is highlighting the line:
ctrl.Top = ctrl.Top + (iLastValue - VSform.Value)

Do you have any idea what could be the problem?


EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum