Problem solve Get help with specific problems with your technologies, process and projects.

Scroll through data entries

Scroll through data entries.

Scroll through data entries
Ron McCarthy

Reader Ron McCarthy gives us a nifty tip on how to see data entries when there are more of them than will fit on your tiny screen.

Have you ever needed to scroll through a large number of data entry elements only to find that the screen isn't big enough to show them all, especially in 800 X 600 resolution. Well here's the answer: "Scrolling Frames."

To see how it works:

  1. Create a form that does not display fully when maximized.
  2. Add a standard frame. Make the frames height bigger than the forms height.
  3. In the frame place as many textboxes as needed to fill the frame from top to bottom. Note: Make them a control array so as not to exceed the 255 controls per form limit.
  4. Add a FlatScrollBar to the form just to the right of the frame.
  5. Set the following properties:
      Appearance = 0 - fsb3D
      Orientation = 0 - cc2OrientationVertical
      LargeChange = 500
      SmallChange = 100

When you run the application and the form is bigger than what can be displayed on the screen, the scroll bar will allow you to scroll the frame up and down so the text boxes will become visible. Of course you could put any of the other VB controls in the frame as needed for your application. The Form_Resize takes care of making the scroll bar fit on the visible form and that the frame will scroll up and down properly.


Option Explicit

Private Sub Form_Load()
End Sub

Private Sub Form_Resize()
    'So the bar doesn't fall off the bottom
    FlatScrollBar1.Height = Me.Height - 400
    'Sets the scrollBar.max to a negitive number
    FlatScrollBar1.Max = Me.Height - (fraMain.Height + 450)
End Sub

Private Sub FlatScrollBar1_Change()
    Frame1.Top = FlatScrollBar1.Value
End Sub

Private Sub FlatScrollBar1_Scroll()
    Frame1.Top = FlatScrollBar1.Value
End Sub

Related Book

Beginning Visual Basic 6 Application Development
Author : Pierre Boutquin, Jason Bock, Diane Poremsky, Matthew Reynolds Kent Sharkey, Ken Slovak, Lee Whitney
Publisher : Wrox Press
Published : Jul 2000
Visual Basic is a versatile language ? accessible to those seeking to enter the world of programming, yet powerful enough to support the coding of complex, distributed applications. By showing you step-by-step how to design, implement, and deploy a fully functional sophisticated application based on an online banking scenario, this book will cover the conceptual and practical implications of application development. We'll cover the full range of topics that impinge on such a project; from software architecture and project planning, through analysis of business requirements and software design by UML, to the practical coding of COM components operating in a transactional environment and the creation of a database to support these activities.

Dig Deeper on Win Development Resources

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.