473,238 Members | 1,935 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,238 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 21641
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...
3
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 3 Jan 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). For other local times, please check World Time Buddy In...
0
by: abbasky | last post by:
### Vandf component communication method one: data sharing ​ Vandf components can achieve data exchange through data sharing, state sharing, events, and other methods. Vandf's data exchange method...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: stefan129 | last post by:
Hey forum members, I'm exploring options for SSL certificates for multiple domains. Has anyone had experience with multi-domain SSL certificates? Any recommendations on reliable providers or specific...
0
Git
by: egorbl4 | last post by:
Скачал я git, хотел начать настройку, а там вылезло вот это Что это? Что мне с этим делать? ...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
0
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...
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...

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.