Scrolling Text Problem

gazeranco

Well-known member
Joined
Feb 11, 2006
Messages
45
Location
Englandshire!
Programming Experience
Beginner
Hello :)

I have the following code to make a linklabel on my form scroll..

VB.NET:
[SIZE=2]
[/SIZE][SIZE=2][COLOR=#0000ff]Private[/COLOR][/SIZE][SIZE=2] [/SIZE][SIZE=2][COLOR=#0000ff]Sub[/COLOR][/SIZE][SIZE=2] Timer1_Tick([/SIZE][SIZE=2][COLOR=#0000ff]ByVal[/COLOR][/SIZE][SIZE=2] sender [/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2] System.Object, [/SIZE][SIZE=2][COLOR=#0000ff]ByVal[/COLOR][/SIZE][SIZE=2] e [/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2] System.EventArgs) [/SIZE][SIZE=2][COLOR=#0000ff]Handles[/COLOR][/SIZE][SIZE=2] Timer1.Tick
[/SIZE][SIZE=2][COLOR=#0000ff]If[/COLOR][/SIZE][SIZE=2] LinkLabelRss.Left <= ([/SIZE][SIZE=2][COLOR=#0000ff]Me[/COLOR][/SIZE][SIZE=2].Left - (2 * LinkLabelRss.Width)) [/SIZE][SIZE=2][COLOR=#0000ff]Then
[/COLOR][/SIZE][SIZE=2]LinkLabelRss.Left = [/SIZE][SIZE=2][COLOR=#0000ff]Me[/COLOR][/SIZE][SIZE=2].Width
[/SIZE][SIZE=2][COLOR=#0000ff]End[/COLOR][/SIZE][SIZE=2] [/SIZE][SIZE=2][COLOR=#0000ff]If
[/COLOR][/SIZE][SIZE=2]LinkLabelRss.Left -= 10
[/SIZE][SIZE=2][COLOR=#0000ff]End[/COLOR][/SIZE][SIZE=2] [/SIZE][SIZE=2][COLOR=#0000ff]Sub
[/COLOR][/SIZE]
But it only seems to work if my form is being displayed on the left hand side of my screen, the form is fairl small about 300x100. If i move the form to the centre of the screen or to the right the scrolling stops functioning correctly, can anyone help? :confused:
 
this was my mistake in the first place, what its doing is where it has:

me.left - (2...

well me.left finds the left hand side of the form, which is completely wrong lol

so try replacing me.left with 0
 
yes, Me.Left is the location of the form's left edge on the screen.

here's how i would do it:
VB.NET:
        LinkLabelRss.Left -= 5
        If LinkLabelRss.Left + LinkLabelRss.Width <= 0 Then LinkLabelRss.Left = Me.Width
 
Back
Top