| 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: Create a form that does not display fully when maximized. Add a standard frame. Make the frames height bigger than the forms height. 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. Add a FlatScrollBar to the form just to the right of the frame. 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. Code: Option Explicit Private Sub Form_Load() Form_Resize 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 |
Scroll through data entries |
Express News India | Freelance ecommerce web development India