Hi, Everybody...
Can anyone knows what is the maximun character limitation of a Label in Vb.net?
Basically i need to scroll a label with timer as Marquee.
The label text is coming from a richtextbox. The richtextbox contains more than billions character.
I replaced all vbLf(LineFeed) of richtextbox with a " * " for getting all character to one line.

But i'm not sure if it will work for label?

Have there any limitation for Label with maximun Character?
Anybody knows?

Recommended Answers

All 4 Replies

A label does not have a MaxLength Property, but it would probably be safe assumtion that it's a 32bit integer number.

So a label would have 2^32 maximum characters. (4294967296 possible characters)

EDIT

Here is a link that leads to an article with a custom marquee control.

actually if your scrolling the info you only need to display whatever will fit in the label; you keep adding character(s)on one end and subtracting character(s) from the other end, the number of characters and the speed with which you add and subtract will determine the speed of the scrolling.

actually if your scrolling the info you only need to display whatever will fit in the label; you keep adding character(s)on one end and subtracting character(s) from the other end, the number of characters and the speed with which you add and subtract will determine the speed of the scrolling.

Dear tinstaafl, can you plz give me an idea on it? Plz if possible submit some code regarding this. I cant get any idea what you want to say.

Here's a simple marquee the label starts with the letters of the alphabet and scrolls slow enough your can read them. Iused a button to start it, and it runs for 1 minute. I didn't take the time to use timers, but I'm sure it could be done.

Public Class Form1
    Dim Marquis As String = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim StartTime, Endtime As Date
        Dim Counter As Integer
        StartTime = Now
        Endtime = StartTime.AddSeconds(60)
        Counter = 0
        While Endtime > Now
            'use Marquis.Chars(Counter) + label1.Text.Substring(0,Label1.Text.Length-1) to reverse direction
            Label1.Text = Label1.Text.Substring(1) + Marquis.Chars(Counter)
            Label1.Refresh()
            'Timer loop
            For I = 1 To 30000000
            Next
            Counter = Counter + 1
            'start over when you get to the end of Marquis
            If Counter > Marquis.Length - 1 Then
                Counter = 0
            End If
        End While

    End Sub
End Class
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.