Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Maximum number of lines in a multi-line textbox
Message
 
À
17/06/2005 13:38:13
Mike Cole
Yellow Lab Technologies
Stanley, Iowa, États-Unis
Information générale
Forum:
ASP.NET
Catégorie:
Formulaires
Versions des environnements
Environment:
VB.NET 1.1
OS:
Windows XP SP2
Divers
Thread ID:
01023442
Message ID:
01024415
Vues:
16
Mike,
Now that I see the code that you are using it is starting to make a little more sense. Well I can atleast duplicate the problem and tell you what the limit of a multiline TextBox is when using SelectedText (or AppendText() which works the same way to my surprise).
The limit is 32767 characters, which happends to be the upper limit of the Short type (not sure what that is in VB.NET). So long story short there must be an line number index that is of type Short. Very interesting and a little odd if you ask me (especially since the maximum value for the MaxLength property is 2147483647 (little over 2 billion) which you might recognize as the upper limit for an int).

Only way around your problem is to do something like this in your method:
if (strMessage =="<CLEAR>")
{
  this.txtStatus.Clear();
}
else
{
  StringBuilder sb = new StringBuilder();
  sb.Append(this.txtStatus.Text);
  sb.Append(strMessage);
  sb.Append(System.Environment.NewLine);
  this.txtStatus.Text = sb.ToString();
}
The problem with that "solution" is that the scroll bars are moved to the beginning of the text.

Einar



>I have the box set to readonly and no scrollbars.
>
>Here is my code:
>
>    Private Sub WriteStatus(ByVal strMessage As String)
>        If Trim(strMessage) = "<CLEAR>" Then
>            txtStatus.Clear()
>        Else
>            txtStatus.SelectedText = Trim(strMessage) & vbCrLf
>        End If
>    End Sub
>
>
>I set max length to a million because I thought that was what it was. There is approximately 30-50 characters per line, and I would give a guess that there are under a hundred lines.
Semper ubi sub ubi.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform