By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
428,787 Members | 2,251 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 428,787 IT Pros & Developers. It's quick & easy.

Scrolling Text in VB.NET Window Form

P: n/a
I need to have a "scrolling" text label or textbox at the bottom of my
window to show the URL of where a song is being played from. I want the
text to scroll on a single line from left to right in case the URL is longer
than the width of the textbox/text label.

Is there a native way to do this in VB.NET?

Nov 21 '05 #1
Share this Question
Share on Google+
5 Replies


P: n/a
Use a panel and set the autoscroll to true.

"Will Gillen" <gi******@nsuok.edu> wrote in message
news:e2**************@TK2MSFTNGP11.phx.gbl:
I need to have a "scrolling" text label or textbox at the bottom of my
window to show the URL of where a song is being played from. I want the
text to scroll on a single line from left to right in case the URL is
longer
than the width of the textbox/text label.

Is there a native way to do this in VB.NET?


Nov 21 '05 #2

P: n/a
Hi Will,

One technique is to use a Timer control and in its Tick handler manipulate a
string to create a scrolling effect e.g.

Private _NowPlaying As String = "This test will get scrolled."
Private Sub NowPlayingTimer_Tick(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles NowPlayingTimer.Tick
_NowPlaying = _NowPlaying.Substring(_NowPlaying.Length - 1, 1) &
_NowPlaying.Substring(0, _NowPlaying.Length - 1)
NowPlayingLabel.Text = _NowPlaying
End Sub

_NowPlaying is a String variable declared at the class level (a class member
field) that holds the string currently being displayed in a label named
NowPlayingLabel.

Each time the Timer's Tick event is handled the _NowPlaying string is
changed by pulling a character off one end of the string and placing at the
other end of the string.

_NowPlaying = _NowPlaying.Substring(_NowPlaying.Length - 1, 1) &
_NowPlaying.Substring(0, _NowPlaying.Length - 1)

After the modification the NowPlayLabel.Text is updated with the
modification.

NowPlayingLabel.Text = _NowPlaying

The end result is a scrolling text effect in the NowPlayingLabel.

Setting the Timer's Interval to 200 produces a nice scroll effect.

--
Mike

Mike McIntyre
Visual Basic MVP
www.getdotnetcode.com
"Will Gillen" <gi******@nsuok.edu> wrote in message
news:e2**************@TK2MSFTNGP11.phx.gbl...
I need to have a "scrolling" text label or textbox at the bottom of my
window to show the URL of where a song is being played from. I want the
text to scroll on a single line from left to right in case the URL is
longer
than the width of the textbox/text label.

Is there a native way to do this in VB.NET?

Nov 21 '05 #3

P: n/a
After seeing scorpian's answer I realized I did not read your question
carefully enough - please ignore my answer.
--
Mike

Mike McIntyre
Visual Basic MVP
www.getdotnetcode.com
"Mike McIntyre" <mi****@dotnetshowandtell.com> wrote in message
news:ek**************@TK2MSFTNGP12.phx.gbl...
Hi Will,

One technique is to use a Timer control and in its Tick handler manipulate
a string to create a scrolling effect e.g.

Private _NowPlaying As String = "This test will get scrolled."
Private Sub NowPlayingTimer_Tick(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles NowPlayingTimer.Tick
_NowPlaying = _NowPlaying.Substring(_NowPlaying.Length - 1, 1) &
_NowPlaying.Substring(0, _NowPlaying.Length - 1)
NowPlayingLabel.Text = _NowPlaying
End Sub

_NowPlaying is a String variable declared at the class level (a class
member field) that holds the string currently being displayed in a label
named NowPlayingLabel.

Each time the Timer's Tick event is handled the _NowPlaying string is
changed by pulling a character off one end of the string and placing at
the other end of the string.

_NowPlaying = _NowPlaying.Substring(_NowPlaying.Length - 1, 1) &
_NowPlaying.Substring(0, _NowPlaying.Length - 1)

After the modification the NowPlayLabel.Text is updated with the
modification.

NowPlayingLabel.Text = _NowPlaying

The end result is a scrolling text effect in the NowPlayingLabel.

Setting the Timer's Interval to 200 produces a nice scroll effect.

--
Mike

Mike McIntyre
Visual Basic MVP
www.getdotnetcode.com
"Will Gillen" <gi******@nsuok.edu> wrote in message
news:e2**************@TK2MSFTNGP11.phx.gbl...
I need to have a "scrolling" text label or textbox at the bottom of my
window to show the URL of where a song is being played from. I want the
text to scroll on a single line from left to right in case the URL is
longer
than the width of the textbox/text label.

Is there a native way to do this in VB.NET?


Nov 21 '05 #4

P: n/a
Actually you were right on, it was me who did not phrase correctly.
Your answer was what I was looking for....

I tried your approach, and it does work, however, it is still a little
"jerky". I had thought about doing it that way, but was thinking there may
be something more "smooth" for the scrolling text... kind of like a
scrolling marquee in HTML...

I'll keep looking... If anyone knows of some control that does this, please
let me know. Thanks.


"Mike McIntyre" <mi****@dotnetshowandtell.com> wrote in message
news:ek**************@TK2MSFTNGP12.phx.gbl...
Hi Will,

One technique is to use a Timer control and in its Tick handler manipulate a string to create a scrolling effect e.g.

Private _NowPlaying As String = "This test will get scrolled."
Private Sub NowPlayingTimer_Tick(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles NowPlayingTimer.Tick
_NowPlaying = _NowPlaying.Substring(_NowPlaying.Length - 1, 1) &
_NowPlaying.Substring(0, _NowPlaying.Length - 1)
NowPlayingLabel.Text = _NowPlaying
End Sub

_NowPlaying is a String variable declared at the class level (a class member field) that holds the string currently being displayed in a label named
NowPlayingLabel.

Each time the Timer's Tick event is handled the _NowPlaying string is
changed by pulling a character off one end of the string and placing at the other end of the string.

_NowPlaying = _NowPlaying.Substring(_NowPlaying.Length - 1, 1) &
_NowPlaying.Substring(0, _NowPlaying.Length - 1)

After the modification the NowPlayLabel.Text is updated with the
modification.

NowPlayingLabel.Text = _NowPlaying

The end result is a scrolling text effect in the NowPlayingLabel.

Setting the Timer's Interval to 200 produces a nice scroll effect.

--
Mike

Mike McIntyre
Visual Basic MVP
www.getdotnetcode.com
"Will Gillen" <gi******@nsuok.edu> wrote in message
news:e2**************@TK2MSFTNGP11.phx.gbl...
I need to have a "scrolling" text label or textbox at the bottom of my
window to show the URL of where a song is being played from. I want the
text to scroll on a single line from left to right in case the URL is
longer
than the width of the textbox/text label.

Is there a native way to do this in VB.NET?


Nov 21 '05 #5

P: n/a
Well, I found a good example at DevCity:
http://www.devcity.net/forums/topic.asp?tid=78584

This is exactly what I was looking for...

"Will Gillen" <gi******@nsuok.edu> wrote in message
news:e2**************@TK2MSFTNGP11.phx.gbl...
I need to have a "scrolling" text label or textbox at the bottom of my
window to show the URL of where a song is being played from. I want the
text to scroll on a single line from left to right in case the URL is longer than the width of the textbox/text label.

Is there a native way to do this in VB.NET?

Nov 21 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.