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 biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Not enough room on form

Status
Not open for further replies.

catalina36

Programmer
Aug 28, 2000
36
US
I'm making a simple invoicing application but am having trouble fitting the whole invoice onto a single form. I'd rather not split up the invoice into multiple forms. What are my options? Is there a way to make a form scrollable or a method of changing the perspective (i.e. zoom in/ zoom out) to fit more of the invoice onto the screen?

I'm kind of new to VB programming. So if the solution to my problem is at all complicated, I'd also appreciate a recommendation on a source which covers the topic in some detail.

TIA
 
If I am not mistaken , a form can automatically scroll vertically if you set it to do so. I forget how. It's one of the properties, or you just set it's scaleheight larger than the form height.
 
Setting the scale height property greater than the height didn't seem to work. I set the form's height to 8,000 twips and its scale height to 10,000 twips but the form did not become scrollable when I ran the app. As such, I was unable to see the command button whose top property was set at 9,000.

BTW, I didn't see a scroll property for the form either.

Is there something I'm missing or something else that I need to do?

TIA
 
I doubt it's going to say "Scroll" but I cant remeber off the top of my head, try vb-world.net for a few mins, try their Tips section, they did have something on scrollable forms.
 

Another option is to use the SSTab control that comes with VB6. It allows you to section off various information but keeps it on the same form. Additionally, you can have common information on the main part of the form so that it can be seen at all times regardless of which tab is being viewed.

For example, you can have the Invoice number, date and customer name on the top portion of the form, the invoice subtotal and tax info near the bottom and a couple of tabs for line items and maybe shipping info!

Just a thought!
 
Or (Yet Another Way To Do It, we should rename this forum to that)

If you make the form an MDI child you can scroll around it using scroll bars on the MDI form (as long as the child form isn't maximised, which surprised me)
 
If interested, here's how to make an ordinary form scroll. (Sorry Karl, I'm not sure of the source, it may have been VB-World as you originally suggested to catalina36.)

Create a form, place a vertical scroll bar, a text box and some other controls on it.

Place these lines in the general area for the form:
[tt]Dim oldPos As Integer
Public Sub pScrollForm()
Dim ctl As Control
For Each ctl In Me.Controls
[tab]If Not (TypeOf ctl Is VScrollBar) Then
[tab][tab]ctl.Top = ctl.Top + oldPos - VScroll1.Value
[tab]End If
Next
oldPos = VScroll1.Value
End Sub
[/tt]

Place these in Form_Load():
[tt]Dim iFullFormHeigth As Integer
Dim iDisplayHeight As Integer
iFullFormHeigth = 3765
iDisplayHeight = 1800
Me.Height = iDisplayHeight
With VScroll1
[tab].Height = Me.ScaleHeight
[tab].Min = 0
[tab].Max = iFullFormHeigth - iDisplayHeight
[tab].SmallChange = Screen.TwipsPerPixelY * 10
[tab].LargeChange = .SmallChange
End With
[/tt]

And call the pScrollForm() sub from these events:
[tt]Private Sub VScroll1_Change()
Call pScrollForm
End Sub
Private Sub VScroll1_Scroll()
Call pScrollForm
End Sub
[/tt]

It should work well enough for most purposes.
 
Catalina -

We've always used a tab control because we found that when you've got scrolling forms, inevitably some dope of a user doesn't spot it and misses filling in data. The tab control "paradigm" is now pretty well understood, since MS uses it in their Office application. It's also nice in that it allows you to logically group related info. I.e. customer contact info on this tab, address info is on this tab, etc.

We actually ran into problems with having too many controls on a form (limit is something less than 250, and we were at 190+), so don't get carried away and put a gazillion controls on a single form. If there's a danger of hitting this limit, you may want to change your process to be more "wizard" like, to allow the user to step through the process without danger of an overloaded form. The smaller forms load faster, too.

Chip H.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top