Scrolling a VB form,


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 7 of 7

Thread: Scrolling a VB form,

  1. #1
    bobby Guest

    Scrolling a VB form,


    I am struggling to make a VB form scrollable. I have many controls in my form
    and I can't see all of them on my screen. i want to make the form scrollable
    so that I can view all of them.
    can some one help me on this.

  2. #2
    Arthur Wood Guest

    Re: Scrolling a VB form,


    Bobby,
    In general, a FORM cannot be "scrollable"- there are no scrool bars that
    can be attached to a form. If you have so many contrls, you might want to
    consider using a Tabbed Dialog Control on the form, nad group the controls
    by functional area, onto separate tabs.

    Arthur Wood


    "bobby" <dare_devil125@hotmail.com> wrote:
    >
    >I am struggling to make a VB form scrollable. I have many controls in my

    form
    >and I can't see all of them on my screen. i want to make the form scrollable
    >so that I can view all of them.
    >can some one help me on this.



  3. #3
    Russ Guest

    Re: Scrolling a VB form,


    "bobby" <dare_devil125@hotmail.com> wrote:
    >
    >I am struggling to make a VB form scrollable. I have many controls in my

    form
    >and I can't see all of them on my screen. i want to make the form scrollable
    >so that I can view all of them.
    >can some one help me on this.


    Bobby,
    You can do this by creating a scrollable viewport. See the following:

    http://support.microsoft.com/support...s/Q71/0/68.ASP

    HTH,
    -Russ.

  4. #4
    Patrick Marshall Guest

    Re: Scrolling a VB form,


    Hi Bobby,

    This is almost the same question as:

    http://news.devx.com/cgi-bin/dnewswe...em=21080&utag=

    or see the article that Russ indicates. Basically you need to put all your
    controls in a picture box then put that picture box in another to make it
    scroll.

    <Patrick>


    "Russ" <russell.thompson@adlink.com> wrote:
    >
    >"bobby" <dare_devil125@hotmail.com> wrote:
    >>
    >>I am struggling to make a VB form scrollable. I have many controls in my

    >form
    >>and I can't see all of them on my screen. i want to make the form scrollable
    >>so that I can view all of them.
    >>can some one help me on this.

    >
    >Bobby,
    >You can do this by creating a scrollable viewport. See the following:
    >
    > http://support.microsoft.com/support...s/Q71/0/68.ASP
    >
    >HTH,
    >-Russ.



  5. #5
    Navdeep Bhardwaj Guest

    Re: Scrolling a VB form,


    Hello,
    For scrolling form you can create a MDI form setting its scrollbar
    property to true. And set your long form's border style to fixed and set
    it mdichild.your form will scroll.

    Navdeep

    "bobby" <dare_devil125@hotmail.com> wrote:
    >
    >I am struggling to make a VB form scrollable. I have many controls in my

    form
    >and I can't see all of them on my screen. i want to make the form scrollable
    >so that I can view all of them.
    >can some one help me on this.



  6. #6
    Richard Guest

    Re: Scrolling a VB form,


    "bobby" <dare_devil125@hotmail.com> wrote:
    >
    >I am struggling to make a VB form scrollable. I have many controls in my

    form
    >and I can't see all of them on my screen. i want to make the form scrollable
    >so that I can view all of them.
    >can some one help me on this.


    http://vbaccelerator.com has a free class module to add scrollbars to any
    control.
    You can download my ScrollRegion UserControl that uses this class module
    from ftp://www.trinet.co.uk/codesamples/scrollregion.zip
    Add both files to your project, and put a scroll-region on your form. Add
    your controls to the control, and use the form_resize event to resize the
    control to fill the form.


  7. #7
    Harry Guest

    Re: Scrolling a VB form,


    You can do it with this code fragment - first drop a vertical scroll control
    on your form (this code assumes it is named "VScroll1"). In the form load,
    set up your min/max stuff the way you like it. When the scroll bar fires
    its event, the event handler zooms thru the form's control collection and
    changes the "TOP" of each control. Experiment for best viewing.


    Dim lPrevValue As Long

    Private Sub Form_Load()
    With VScroll1
    .Min = 0
    .Max = Me.Height \ Screen.TwipsPerPixelY
    .LargeChange = .Max \ 10
    End With
    End Sub

    Private Sub VScroll1_Change()
    Dim i As Integer, lDelta As Integer
    lDelta = (lPrevValue - VScroll1) * Screen.TwipsPerPixelY
    For i = 0 To Me.Count - 1 'loop thru all controls on form
    With Me.Controls(i)
    If .Name <> "VScroll1" Then .Top = .Top + lDelta ' don't move
    the scroll bar too!
    End With
    lPrevValue = VScroll1.Value
    Next
    End Sub


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center