Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

need help with scrollbar

FMPFMP Posts: 5Member
hello, i am a student just learning VB and the book that my class is using does not have any thing about scrollbars, and i cant get it to work, can someone please explane how to make it work right (either through explanation or throught example). thank you.

Comments

  • pseudocoderpseudocoder Posts: 687Member ✭✭✭
    : hello, i am a student just learning VB and the book that my class is using does not have any thing about scrollbars, and i cant get it to work, can someone please explane how to make it work right (either through explanation or throught example). thank you.
    :

    I'm hardly a VB guru, but I'll try to offer something - for VB anyway... dunno about .Net. If you're using the built in controls, then

    VScroll and HScroll both have a max and min property that can be set at run time. For example, if you create a project that has a list box, and a vertical scroll bar for a class of 5 students, and each value of the scroll bar represents a single student that is in the listbox then

    [code]
    Form_Load

    Dim i As Integer

    For i = 0 To 4
    List1.AddItem "Student " & CStr(i + 1)
    Next

    vscroll1.Min = 0
    vscroll1.Max = 4
    vscroll1.Value = 0

    List1.Selected(vscroll1.Value) = True
    ------------------

    VScroll1_Change

    List1.Selected(VScroll1.Value) = True ' choose the desired student
    ------------------[/code]

    If you ran that, you *should* see the highlighted item in the list box change in relation to the current value of the scroll bar.
  • FMPFMP Posts: 5Member
    thanks, i will try that.
  • FMPFMP Posts: 5Member
    i tried that bit of code and got it to work but when i tried to apply it to what i am doing i could not get it to work.

    in short, i am trying to get a scroll bar to work with a large amount of text, i am not sure if i should use a label or an OLE. also something i forgot to mention, i am useing a student version which has some of the features disabled.

    thanks
  • Bulgarian_VBBulgarian_VB Posts: 307Member
    : i tried that bit of code and got it to work but when i tried to apply it to what i am doing i could not get it to work.
    :
    : in short, i am trying to get a scroll bar to work with a large amount of text, i am not sure if i should use a label or an OLE. also something i forgot to mention, i am useing a student version which has some of the features disabled.
    :
    : thanks
    :
    Just put all the text in a textbox, and enable scrollbars from the TextBox properties. If you don't want the text to be editted, just set the Locked property to True.

    Using Label with external scrollbar to scroll the text is somewhat complicated, so don't look into that right now.

    Hope I helped,
    Nikolay Semov

  • FMPFMP Posts: 5Member
    thank you, i will try that.

    FMP
  • FMPFMP Posts: 5Member
    everything i have done has not worked, might you have any other sugestions? thank you.

    FMP
Sign In or Register to comment.