Results 1 to 9 of 9

Thread: [RESOLVED] Frame With Scroll Bar

  1. #1

    Thread Starter
    Hyperactive Member CHAMPGARY's Avatar
    Join Date
    Jul 2002
    Posts
    386

    Resolved [RESOLVED] Frame With Scroll Bar

    Hello,

    I want to scrool the frame using Horizontal scroll Bar.
    Please look at the form attached.
    If user want to add more than 10 items
    then he scroll down and add more item.
    Can anybody give me some input for coding.

    Thanx in advance,
    Champgary
    Attached Files Attached Files

  2. #2
    VB Guru ganeshmoorthy's Avatar
    Join Date
    Dec 2005
    Location
    Sharjah, United Arab Emirates
    Posts
    3,031

    Re: Frame With Scroll Bar

    have one more frame inside the main frame and have the scroll bars on the main frame and controls on the inside frame. according to the scroll bar move the controls frame... this works...
    If an answer to your question has been helpful, then please, Rate it!

    Have done Projects in Access and Member management systems using BioMetric devices, Smart cards and BarCodes.


  3. #3

    Thread Starter
    Hyperactive Member CHAMPGARY's Avatar
    Join Date
    Jul 2002
    Posts
    386

    Re: Frame With Scroll Bar

    I try to use code by martinliss...
    but something going wrong can anybody help me to solve
    I have attached updated form.
    Attached Files Attached Files
    Regards,
    CHAMPGARY

  4. #4
    PowerPoster jcis's Avatar
    Join Date
    Jan 2003
    Location
    Argentina
    Posts
    4,430

    Re: Frame With Scroll Bar

    Try this in your Form_Load event..
    VB Code:
    1. Private Sub Form_Load()
    2.     VScroll1.Height = PicWindow.Height
    3.     VScroll1.Min = PicWindow.Top
    4.     VScroll1.Max = PicWindow.Height
    5.     VScroll1.SmallChange = 100
    6.     VScroll1.LargeChange = PicPicture.Height
    7. End Sub
    And this in VScroll1_Change
    VB Code:
    1. Private Sub VScroll1_Change()
    2.     PicWindow.Top = -VScroll1.Value
    3. End Sub

  5. #5

    Thread Starter
    Hyperactive Member CHAMPGARY's Avatar
    Join Date
    Jul 2002
    Posts
    386

    Re: Frame With Scroll Bar

    oooppss...I put your code but now when I scroll picture box is vanishing.
    In martinliss code he is doing the same thing
    here is his code.
    Can you tell why this is not working for me
    Attached Files Attached Files
    Regards,
    CHAMPGARY

  6. #6
    PowerPoster jcis's Avatar
    Join Date
    Jan 2003
    Location
    Argentina
    Posts
    4,430

    Re: Frame With Scroll Bar

    Did you add that VScroll1_Change event I added in my previous post?
    Also, Inside MartinLiss sub Change all PicPicture with PicWindow and it will work.
    Also make KeyPreview = true for your Form.
    the main problem is that you are not using the correct names for each picturebox, picWindow should be PicPicture and Picpicture should be PicWindow
    Here is the code
    VB Code:
    1. Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
    2.     CheckKeyCode KeyCode
    3. End Sub
    4.  
    5. Private Sub Form_Load()
    6.     VScroll1.Height = PicWindow.Height
    7.     VScroll1.Min = PicWindow.Top
    8.     VScroll1.Max = PicWindow.Height
    9.     VScroll1.SmallChange = 100
    10.     VScroll1.LargeChange = PicPicture.Height
    11.     Me.KeyPreview = True
    12. End Sub
    13.  
    14. Private Sub VScroll1_Change()
    15.     PicWindow.Top = -VScroll1.Value
    16. End Sub
    17.  
    18. Public Sub CheckKeyCode(KeyCode As Integer)
    19. '***************************************************************************
    20. 'Purpose: Intercept and act on special keys on me so
    21. '         that up and down arrows and scroll bar works as expected. Also
    22. '         automatically scroll screen when Tab key would otherwise disappear
    23. '         off the screen.
    24. 'Inputs:  KeyCode - The ASCII(?) value of the key pressed
    25. 'Outputs: None
    26. '***************************************************************************
    27.  
    28.     Dim nScrollValue As Double
    29.     Dim nOnePage As Integer
    30.    
    31.     nOnePage = Me.VScroll1.Height
    32.    
    33.     If KeyCode = vbKeyPageUp Or KeyCode = vbKeyPageDown Then
    34.         If KeyCode = vbKeyPageDown Then
    35.             nScrollValue = -Me.PicWindow.Top + nOnePage
    36.         Else
    37.             nScrollValue = -Me.PicWindow.Top - nOnePage
    38.         End If
    39.         'Make sure that the scroll bar 'handle' is not attempted to be positioned
    40.         'below the bottom of the scroll bar.
    41.         If nScrollValue > Me.VScroll1.Max Then
    42.             nScrollValue = Me.VScroll1.Max
    43.             Me.PicWindow.Top = -Me.VScroll1.Max
    44.         End If
    45.         If nScrollValue > 0 Then
    46.             Me.VScroll1.Value = nScrollValue
    47.         Else
    48.             Me.VScroll1.Value = 0
    49.         End If
    50.     End If  
    51. End Sub
    And now I'll see Martinliss code you posted
    Ok, saw ML code, with the code I posted here your app is doing exactly the same, at least here.
    Last edited by jcis; Feb 15th, 2006 at 10:42 PM.

  7. #7

    Thread Starter
    Hyperactive Member CHAMPGARY's Avatar
    Join Date
    Jul 2002
    Posts
    386

    Re: Frame With Scroll Bar

    THANKS JCIS,


    You solved this, perhaps I missed out something.
    Thanks for your help
    Regards,
    CHAMPGARY

  8. #8
    Addicted Member LeonX's Avatar
    Join Date
    Dec 2004
    Location
    Jakarta, Indonesia
    Posts
    172

    Frame With Scroll Bar

    hi champ ...
    try this, hope this solved your problem ...
    and, my pm to you is has not been answered yet.
    Attached Files Attached Files
    Regards,
    Ferry

  9. #9

    Thread Starter
    Hyperactive Member CHAMPGARY's Avatar
    Join Date
    Jul 2002
    Posts
    386

    Re: [RESOLVED] Frame With Scroll Bar

    HI LeonX,


    Thanks alot.
    It looks quite smart
    I can scroll frame itself.
    That is what I really want.
    Regards,
    CHAMPGARY

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width