|
-
Jan 11th, 2003, 11:48 AM
#1
Thread Starter
New Member
how to use a scrollbar
hi,
I am a noob in vb and now I want to create a form with a vertikal scrollbar at the right border.
but how can I make it, that the scrollbar scrolls ?! 
I only have text written in this form and only want it to scroll down...
perhaps you can help me and write and example or so...
thanx a lot,
stylewriter
-
Jan 11th, 2003, 11:55 AM
#2
Fanatic Member
If you want to know if the scroll bar has been scrolled, check out the event subroutine as you would for the other controls. Use the scroll/change event.
THE TIME/WEATHER IS 
Don't know how to use APIs or have problem with them,
Download API-Guide & API-Viewer from http://www.allapi.net
-
Jan 11th, 2003, 11:58 AM
#3
Lively Member
Hmm
Well, If you're trying to scroll the text that you output to the form using the Print method, you have to do some work to preserve the text. But the easiest way is to just use a Text Box with the MultiLine Property set to true. It will automatically scroll upwards and Downwards.
Anyway, you can get the value of the scrollbar by putting code into the VScrollBar1_Scroll event or VScrollBar1_Change event.
To get an Idea, do the following.
VB Code:
Private Sub VScrollBar1_Scroll
Text1.Text = VScrollBar1.Value
EndSub
.:JanuZ:.
.:JanuZ:.XtremeSoft

-
Jan 11th, 2003, 12:06 PM
#4
Thread Starter
New Member
sorry guys, I am a total noob 
can you perhaps post how I can scroll down with labels?
I have got several labels (named Label1, Label2,...) in a form and want to scroll them up / down...
-
Jan 11th, 2003, 12:15 PM
#5
Fanatic Member
I have no VB Access right now. But from the top of my head...
VB Code:
'In a form
Dim LastV as Integer
Private Sub Form_Load()
LastV = VScrollBar1.Value
End Sub
Private Sub VScrollBar1_Scroll()
'Move the label depending on the scroll
'If the scroll value increases, subtraction will become addition
Label1.Top = Label1.Top - (LastV - VScrollBar1.Value)
'Save the Last scroll value
LastV = VScrollBar1.Value
End Sub
Add a scrollbar (VScrollBar1) and a label (Label1) to the form
THE TIME/WEATHER IS 
Don't know how to use APIs or have problem with them,
Download API-Guide & API-Viewer from http://www.allapi.net
-
Jan 11th, 2003, 12:29 PM
#6
Thread Starter
New Member
oukei, now the scrolling is possible.
but only in one way 
if I press the up or down button the labels scroll down!
if I change the - with + it only scrolls upwards.
how have I got to set the values of the scrollbar?
the max, min, value - values...
sorry about these stupid questions
-
Jan 11th, 2003, 12:39 PM
#7
Thread Starter
New Member
I found my mistake!
Everything is allright now 
thanx a lot!!!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|