Results 1 to 4 of 4

Thread: Scroll bars

  1. #1

    Thread Starter
    New Member
    Join Date
    Aug 2000
    Location
    N.Ireland
    Posts
    7
    Hi,
    Bit of a dumb question, Can you add vertical and horizotal scroll bars to scroll through text in a label?

    Cheers

  2. #2
    Frenzied Member wengang's Avatar
    Join Date
    Mar 2000
    Location
    Beijing, China
    Posts
    1,604
    awkward maybe

    horizontal
    assign the max value of the bar to equal, say, the number of characters in the caption. Then assign the caption to a string at Form_Load make a second string of x characters long and make that the new caption of the label. On the scroll change event, use a Mid statement to extract the x number of characters from within the original label from character x to character x + (?) . That will make x number of characters show on the label and each click on the scrollbar will make the first disappear and the next in line appear at the end.

    Is that anything close to what you mean?

  3. #3
    Frenzied Member wengang's Avatar
    Join Date
    Mar 2000
    Location
    Beijing, China
    Posts
    1,604
    sorry. that was a bit vague. I just did one. Here is my code, with only a Label and a Horizontal Scroll:

    Dim strWholeText As String, strSegment As String
    Dim intPlaceNumber As Integer

    Private Sub Form_Load()
    strWholeText = "Four Score and Seven Years ago..."
    HScroll1.Max = Len(strWholeText)

    strSegment = "Four "

    Label1.Caption = strSegment

    End Sub

    Private Sub HScroll1_Change()
    Label1.Caption = Mid(strWholeText, HScroll1.Value, 4)

    End Sub

  4. #4

    Thread Starter
    New Member
    Join Date
    Aug 2000
    Location
    N.Ireland
    Posts
    7
    Thanks,
    That should do the trick

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