Login or Sign Up
Logging in...
Remember me
Log in
Or
Sign Up
Forgot password or user name?
Log in with
Search in titles only
Search in Visual Basic only
Search
Advanced Search
Forums
Product Launch
Updates
Today's Posts
Member List
Calendar
Home
Forum
Topic
Visual Basic
how to use a timer control in vb6
Collapse
X
Collapse
Posts
Latest Activity
Photos
Page
of
1
Filter
Time
All Time
Today
Last Week
Last Month
Show
All
Discussions only
Photos only
Videos only
Links only
Polls only
Events only
Filtered by:
Clear All
new posts
Previous
template
Next
Vbbeginner07
New Member
Join Date:
Dec 2007
Posts:
103
#1
how to use a timer control in vb6
Mar 6 '08, 07:54 AM
I have placed a label in a form,i have to move the label from left to right.........h own can i do this uising a timer control........ ..???i need the interval of 1000..........p lease Check.......... ..
NICK...........
debasisdas
Recognized Expert
Expert
Join Date:
Dec 2006
Posts:
8119
#2
Mar 6 '08, 08:39 AM
You need to handle the TOP and LEFT properties of the label on timer event.
Comment
Post
Cancel
gobblegob
New Member
Join Date:
Dec 2007
Posts:
133
#3
Mar 6 '08, 09:51 AM
Hi ,
This is what i use.
Add 2 labels tor the form called lblScrollL2R and lblScrollR2L , Set AutoSize =True , Set BackStyle = 0-Transparent.
Add Timer called TmrScroll and set interval to 50
DECLARATIONS:
[CODE=vb]Dim intDeltaX As Integer
Private Sub Form_Load()
lblScrollL2R.Le ft = Me.ScaleLeft - lblScrollL2R.Wi dth
lblScrollR2L.Le ft = Me.ScaleWidth '+ 60
intDeltaX = 30
End Sub
Private Sub TmrScroll_Timer ()
With lblScrollL2R 'Left to right part
.Left = .Left + intDeltaX
If .Left > Me.ScaleWidth Then
.Left = Me.ScaleLeft - .Width
End If
End With
With lblScrollR2L 'Right to left part
.Left = .Left - intDeltaX
If .Left + .Width < Me.ScaleLeft Then
.Left = Me.ScaleWidth '+ 60
End If
End With
End Sub[/CODE]
Gobble.
Last edited by
debasisdas
;
Mar 6 '08, 10:01 AM
.
Reason:
added code=vb tags
Comment
Post
Cancel
Ali Rizwan
Banned
Contributor
Join Date:
Aug 2007
Posts:
931
#4
Mar 6 '08, 11:29 AM
Hi,
Add a label and a timer to your project and add this code.
[CODE=vb]Private Sub Form_Load()
Label1.Left = 0 - Label1.Width
Label1.Top = 10
End Sub
Private Sub Timer1_Timer()
Label1.Left = Label1.Left + 10
If Label1.Left > Me.Width + Label1.Width Then
Label1.Left = 0 - Label1.Width
End If
End Sub[/CODE]
Regards
>> ALI <<
Last edited by
debasisdas
;
Mar 6 '08, 11:55 AM
.
Reason:
added code=vb tags
Comment
Post
Cancel
Vbbeginner07
New Member
Join Date:
Dec 2007
Posts:
103
#5
Mar 7 '08, 09:36 AM
THANK you all!!!
IF I HAVE TO BOUNCE BACK THE LABEL FROM APARTICULAR POINT AND MOVES IN THE OPP.DIRECTION.. ......pLEASE hELP ME!!!
nICK
Comment
Post
Cancel
debasisdas
Recognized Expert
Expert
Join Date:
Dec 2006
Posts:
8119
#6
Mar 7 '08, 10:18 AM
Previously was using addition . to move in opposite direction use subtraction.
Comment
Post
Cancel
Previous
template
Next
Working...
Yes
No
OK
OK
Cancel
👍
👎
☕
Comment