•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the VB.NET section within the Software Development category of DaniWeb, a massive community of 403,384 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 4,538 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our VB.NET advertiser: Programming Forums
Views: 1034 | Replies: 4
![]() |
•
•
Join Date: Jan 2008
Posts: 43
Reputation:
Rep Power: 1
Solved Threads: 4
drag a timer on your form and a label double click on timer and you will have its event where you need to code.
now put one loop and condition in which you will define Left Position of Label and by condition you will check if label left position is 0 then move to right. That is all the theme behind your code. Plz try to code and if it doesnt work then send me the code at my email [email removed as per forum rules]
now put one loop and condition in which you will define Left Position of Label and by condition you will check if label left position is 0 then move to right. That is all the theme behind your code. Plz try to code and if it doesnt work then send me the code at my email [email removed as per forum rules]
Last edited by WolfPack : Mar 25th, 2008 at 10:20 am.
•
•
Join Date: Jul 2008
Posts: 4
Reputation:
Rep Power: 0
Solved Threads: 0
Hi all
Hi to move a label box from left to right and right to left with the help of timers.
Also how to change the fore color of the label (RAndom colcors )with the help of timers
Thanks in advance[/quote]
Hi all
Hi to move a label box from left to right and right to left with the help of timers.
Also how to change the fore color of the label (RAndom colcors )with the help of timers
Thanks in advance[/quote]
Hi all
Hi to move a label box from left to right and right to left with the help of timers.
Also how to change the fore color of the label (RAndom colcors )with the help of timers
Thanks in advance[/quote]
Hi to move a label box from left to right and right to left with the help of timers.
Also how to change the fore color of the label (RAndom colcors )with the help of timers
Thanks in advance[/quote]
Hi all
Hi to move a label box from left to right and right to left with the help of timers.
Also how to change the fore color of the label (RAndom colcors )with the help of timers
Thanks in advance[/quote]
Hi all
Hi to move a label box from left to right and right to left with the help of timers.
Also how to change the fore color of the label (RAndom colcors )with the help of timers
Thanks in advance[/quote]
•
•
Join Date: Feb 2008
Location: Sivakasi, Tamilnadu, India
Posts: 403
Reputation:
Rep Power: 1
Solved Threads: 69
Use Rnd () function to Get the Random value.
The Rnd function returns a value less than 1, but greater than or equal to zero.
Example
You will get the value 0 to 255
By using Rnd() in timer, generate Color from Color.FromArgb() function and Set this for forecolor
The Rnd function returns a value less than 1, but greater than or equal to zero.
Example
Dim value As Integer = CInt(Int((256 * Rnd())))
You will get the value 0 to 255
By using Rnd() in timer, generate Color from Color.FromArgb() function and Set this for forecolor
KSG
•
•
Join Date: Dec 2002
Location: West Virginia
Posts: 375
Reputation:
Rep Power: 6
Solved Threads: 38
Try this:
Public Class Form1
Dim RanNum As New Random ' Random number generator
Dim DistMove As Integer = 10 ' The distance the label moves each time
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
' Add distance to label
Label1.Left += DistMove
' Check if label has reach the right side of window
If Label1.Left + Label1.Width > Me.ClientRectangle.Width Then
' If so make sure none is hidden
Label1.Left = Me.ClientRectangle.Width - Label1.Width
' Reverse the direction - if positive make negative, if negative make positive
DistMove = Not DistMove
ElseIf Label1.Left < 0 Then
' If label is less than zero make it zero
Label1.Left = 0
' Reverse the direction
DistMove = Not DistMove
End If
' Change the forecolor of the label. The RanNum.Next gives a number between 0 and 255
Me.Label1.ForeColor = Color.FromArgb(255, RanNum.Next(0, 255), RanNum.Next(0, 255), RanNum.Next(0, 255))
End Sub
End Class Wayne
It is hard to understand how a cemetery can raise its burial rates and blame it on the cost of living.
It is hard to understand how a cemetery can raise its burial rates and blame it on the cost of living.
![]() |
•
•
•
•
•
•
•
•
DaniWeb VB.NET Marketplace
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
Similar Threads
- trojans...now nothing opens and I get a paint can't open error (Viruses, Spyware and other Nasties)
Other Threads in the VB.NET Forum
- Previous Thread: Crystal Reports doesnt show proper output
- Next Thread: TreeViewCollection Help!


Linear Mode