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!

Increase the form area 1

Status
Not open for further replies.

azamatali

Programmer
Aug 20, 2001
50
0
0
IN
hi everybody,
i am making a visual basic form, which has around 75 fields in it.... the problem is that i am unable to fit all these 75 fields in one form even on maximizing the form..
in many of the application, i have seen the scroll bar coming with the long form.. but i don't know how to do it..
If any of u can guide me for this, i w'd be very grateful
Thanks
 
Make the form the size that you need. When you click on a blank area of the form you will see the object markers on the form borders. Put your mouse on the edge of the form over the top of one of these markers (one in each corner and midway). Click and drag the form to the size that you want, even going off the screen. (You could change the Height property in the Property window or in code to a value that meets your needs also).
When the form then opens, the scroll bars should be automatically there.
 
1) You would have to move your contorls programatically if you want to utilize the scrolld bar.

2) Why do you have that many controls on 1 form. You should break this, up it's not easy to work with and gets very busy to the eye.

What I suggest you do is this. Break your program up into 2 or 3 gatagories. Then split the text boxes into their catagories and use a Tabbed Control. SO now rather than having 75 fields filling up one form and going off the screen, you can have all 75 fields on the same form, but on 3 different tabs so the user only sees 25 at a time, and you make your program 3 times smaller.

Before you go and say, no I think it's OK having a big form. Do this, change your screen resolution to 640 X 800, you would be surprised at how many people work in this resolution. Do you still think your forms OK. Craig, mailto:sander@cogeco.ca

"Procrastination is the art of keeping up with yesterday."

I hope my post was helpful!!!
 
If you cannot size the form any more with the mouse, then change the height value in the property window to whatever you want. It will work.

You didn't say why you want so many controls on one form, but only that you wanted a form long enough - "like other applications" - the need could be well justified - so in my answer I will respecting your wish for this info.

Occasions do arise where this is needed (ínternet page), and when it is, then most programmers expand vertically, but not horizontally, unless there is a wide grid or something like this.

 
or you could make the form an activex form and display it in a web browser. Craig, mailto:sander@cogeco.ca

"Procrastination is the art of keeping up with yesterday."

I hope my post was helpful!!!
 
Another approach is thru the use of two frames, and the standard scroll bar control. Specific values for Height and Width may vary depending on your screen settings, and available screen real estate.

1. Create a frame (fraVisible) that is the viewable area on the screen. Be sure to increase the width of this frame to allow for the scroll bar. For this example, I have the following property settings:

Height = 5100
Left = 750
Top = 3600
Width = 12600

2. Add the standard scroll bar to the the fraVisible frame, and place is at the far right hand side of the Visible frame. Set the height of the scroll bar so that it uses the entire visible height space, keeping both the top and bottom scroll buttons visible. I have the following property settings

Height = 5115
Left = 12270
Top = 0
Width = 315

Also set the following scroll bar properties

Max = 100
Min = 0

I also set the following two properties, although you may adjust these to match your desired behavior

LargeChange = 20
SmallChange = 4

Remember, the scroll bar has been placed in the fraVisible Frame.

3. Create a second frame (fraScroll), on the fraVisible frame, but set the height of the second frame to be large enough to hold all of your controls, and then place all of your controls on this frame. In this example, I have the following properties set.

Height = 19740
Top = 0
Left = 0
Width = 12270

Again, this frame is placed on the fraVisible frame

4. Add the following event handler to your code

Private Sub scrBar_Change()

fraScroll.Top = -(scrBar.Value / 100) * (fraScroll.Height - fraVisible.Height)

End Sub


Note: In order to make design adjustments to the controls on the fraScroll frame, you will have to manually position the frame during design. Change the top property to some negative number, and you will be able during design to see those portions not initially visible. Be sure to set the top property back to 0 when design is complete, or in the Form_Load event, add fraScroll.Top = 0.


Good Luck
 
Sweet answer Cajun.

I actually have a form with about 30 scroll bars that need to be in the same frame, I used to move the controls around but that is a mucho better solution. Craig, mailto:sander@cogeco.ca

"Procrastination is the art of keeping up with yesterday."

I hope my post was helpful!!!
 
It's a program the monitors Drive space. We have a lot of systems that produce nightly reports and the operators need to be notified if a drive is filling up during reporting so that they can do somethign about it. So I have all these horizontal sorry, progress bars 1 for each drive including all the network drives and local drives. Each one of those also has a slider bar on top so that they can set their own thresholds.

I can send a screen shot if your interested, just send me an email. Craig, mailto:sander@cogeco.ca

"Procrastination is the art of keeping up with yesterday."

I hope my post was helpful!!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top