473,320 Members | 2,073 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Scrolling Text in VB.NET Window Form

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
5 21653
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
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
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Midas NDT Sales | last post by:
I have been looking at a simple example of a scrolling text box (the one in the SAM book) as below: <script language="JavaScript"> var pos=100; function Scroll() { if...
3
by: Scott M | last post by:
Hi, I am currently trying to write a simple game using vb.net the form I am working on is 800*600 (this is set as the maximum size) and autoscroll is set to true. The user moves around the...
3
by: Vikram Bhatia | last post by:
1. Is there an event to capture scrolling using mouse wheel in Netscape 6.x? 2. When arrow keys are used to scroll a page in Netscape 6.x, the scrolling offsets obtained using...
2
by: James CC | last post by:
I have a strange bug in C# using windows forms. To make sure it's not some bug with my code, I've gone back to a simple test app, and still see the same behavior. I have created a simple C#...
0
by: Scott M | last post by:
Hi, I am currently trying to write a simple game using vb.net the form I am working on is 800*600 (this is set as the maximum size) and autoscroll is set to true. The user moves around the...
2
by: P2P | last post by:
Hi I am wondering if someone know of a free cross-browsers vertical scrolling script that - is cross cross-browsers - will call the scrolling content from an external html page or from a...
4
by: Keith Bentrup | last post by:
Hi all, I wrote a simple search function to find text in a textarea where not all the text is visible (ie. the text box displays 10 lines but there may be more than 1000 lines to search). I can...
3
by: Chamnap | last post by:
Hello everybody, I have one problem. I want to do something after the user finished scrolling. The scroll event fires whenever the user is scrolling. I don't want this actually. Does anyone has...
11
by: =?Utf-8?B?UmF5IE1pdGNoZWxs?= | last post by:
Hello, I know I sound like a one-note Johnny on this but I'm still looking for a solution. I need to display characters coming in from a serial port or a socket. I also need to be able to type...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.