Solved

Scrolling in a Frame

Posted on 2002-05-23
10
322 Views
Last Modified: 2006-11-17
I have a number of text boxes (an array of them if that would help), that won't fit in a frame. This number can be got at run time and I could use a Load txtBox(i) ! The problem is to scroll the text boxes in a frame! How do I do it? Pls help anyone out there!
0
Comment
Question by:anantharaman_n
  • 2
  • 2
  • 2
  • +4
10 Comments
 
LVL 39

Accepted Solution

by:
appari earned 150 total points
ID: 7029107
use a frame inside another frame
and keep one scroll bar attached to outer frame, on scrollbars change event reposition inner frame. keep the text boxes in inner frame.

hope this helps
0
 
LVL 39

Expert Comment

by:appari
ID: 7029112
use picture box instead of frame for outer frame
0
 
LVL 2

Expert Comment

by:priya_pbk
ID: 7029118
Try putting the Vscroll control(vertical scroll) on the form/frame and do the necessary coding for moving the form or frame vertically as required to show the text boxes.

I think alternatively you can also try using the HScroll (Horizontal scroll bar) if the form is wider than the screen.

Try this link, this can give you some idea on how to go abt it:
http://www.planet-source-code.com/vb/scripts/ShowCode.asp?txtCodeId=153&lngWId=-1

Priya.
0
Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

 

Expert Comment

by:unni_bcanti
ID: 7029180
Refer the following TOPIC in MSDN

HOWTO: Create Scrollable Viewports
ID: Q186429
0
 
LVL 75

Expert Comment

by:Anthony Perkins
ID: 7029755
unni_bcanti,

Welcome to EE.  Please do not lock questions with answers, but instead use comments.  This still allows the questioner to award your comment the points if he/she feels your comment solves the problem.

Thanks,
Anthony
0
 

Author Comment

by:anantharaman_n
ID: 7031154
I could not find the topic "Create Scrollable Viewport" in my MSDN help. Could I get the specific search topic please? In the meanwhile, I have got something from priya_pbk, that looks like a solution -- I have not gone through the code yet -- but rest assured, if the problem is olved, the points are yours. Thanx all you wonderful ppl out there!
0
 

Expert Comment

by:unni_bcanti
ID: 7031170
Steps to Create Sample Project
Start a new Standard EXE project in Visual Basic. Form1 is created by default.


Add two Picture boxes to Form1. Make sure that Picture2 is sited inside Picture1.


Add a horizontal scroll bar and a vertical scroll bar to Form1.


Copy the following code to the Code window of Form1.

NOTE: Add the path and filename to your picture file in the appropriate section of the Form_Load event:



      Option Explicit

      Private Sub Form_Load()

         Picture1.Move 0, 0, ScaleWidth - VScroll1.Width, _
                              ScaleHeight - HScroll1.Height

         With Picture2
            ' Expand the boundaries of Picture2 picture box to the size
            ' of the actual bitmap.
            .AutoSize = True

            ' Enter the path and file name as the argument to the
            ' LoadPicture method.
            .Picture = LoadPicture("splash.bmp")

            ' Initialize location of both pictures.
            .Move 0, 0
         End With

         ' Position the horizontal scroll bar.
         With HScroll1
            .Top = Picture1.Height
            .Left = 0
            .Width = Picture1.Width
         End With

         ' Position the vertical scroll bar.
         With VScroll1
            .Top = 0
            .Left = Picture1.Width
            .Height = Picture1.Height
         End With

         ' Set the Max value for the scroll bars.
         HScroll1.Max = Picture2.Width - Picture1.Width
         VScroll1.Max = Picture2.Height - Picture1.Height
         HScroll1.LargeChange = HScroll1.Max / 10
         VScroll1.LargeChange = VScroll1.Max / 10

         ' Determine if child picture will fill up screen.
         ' If so, then there is no need to use scroll bars.

         VScroll1.Visible = (Picture1.Height < Picture2.Height)
         HScroll1.Visible = (Picture1.Width < Picture2.Width)
      End Sub

      Private Sub HScroll1_Change()
        ' Picture2.Left is set to the negative of the value because
        ' as you scroll the scroll bar to the right, the display
        ' should move to the Left, showing more of the right
        ' of the display, and vice-versa when scrolling to the
        ' left.

         Picture2.Left = -HScroll1.Value

      End Sub

      Private Sub VScroll1_Change()
        ' Picture2.Top is set to the negative of the value because
        ' as you scroll the scroll bar down, the display
        ' should move up, showing more of the bottom
        ' of the display, and vice-versa when scrolling up.

        Picture2.Top = -VScroll1.Value

      End Sub

      Private Sub Form_Resize()
         ' The Picture1 picture box dimensions are changed when the form
         ' size is changed.
         With Picture1
            .Height = Form1.Height
            .Width = Form1.Width
         End With

         ' Re-Initializes picture positions & scroll bars.
         Picture1.Move 0, 0, ScaleWidth - VScroll1.Width, _
                           ScaleHeight - HScroll1.Height
         Picture2.Move 0, 0

         With HScroll1
            .Top = Picture1.Height
            .Left = 0
            .Width = Picture1.Width
            .Max = Picture2.Width - Picture1.Width
         End With

         With VScroll1
            .Top = 0
            .Left = Picture1.Width
            .Height = Picture1.Height
            .Max = Picture2.Height - Picture1.Height
         End With

         ' Checks to see if scroll bars are needed
         VScroll1.Visible = (Picture1.Height < Picture2.Height)
         HScroll1.Visible = (Picture1.Width < Picture2.Width)
      End Sub
 
On the Run menu, click Start or press the F5 key to start the program. If you do not see any scroll bars, reduce the size of the form until you see the scroll bars.
0
 
LVL 75

Expert Comment

by:Anthony Perkins
ID: 7033417
anantharaman_n,

>>I could not find the topic "Create Scrollable Viewport" in my MSDN help. Could I get the specific search
topic please?<<
Assuming that you are using IE and you have been given the KB number than you can enter the following in the address of the browser:

MSKB Q######

Where ###### is the knowledge base number.

So in this case you were given Q186429 than you would enter:
MSKB Q186429

This should resolve to:
http://support.microsoft.com/default.aspx?scid=kb;en-us;Q186429&SD=MSKB&

Anthony
0
 
LVL 12

Expert Comment

by:guidway
ID: 7192035
This question appears to have been abandoned. A Moderator will be asked
to close this question after seven days, with the following recommended disposition:

Points to appari

If you have any comment or objection to the recommendation, please leave
it here.

guidway
EE Cleanup Volunteer
0
 
LVL 5

Expert Comment

by:Netminder
ID: 7208122
Per recommendation, force-accepted.

Netminder
CS Moderator
0

Featured Post

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
How to create a duplicate finder Application 9 120
message box in access 4 46
How to measure sizes and angles in scanned images ? 3 63
clicking a shape in a frame array vb6 3 45
There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

786 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question