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

AppendText Method of TextBox, 32K limit?

P: n/a
VB .NET 2003, WinXP Pro:

Adding text to a text box with the TextBox.AppendText method limits the
amount of text in the textbox to 32K.

I have a short program that uses the GetFiles function of the directory
object, then iterates through the returned array and appends the strings to
the textbox. However, if the character count is greater than 32k, no
additional text is displayed in the textbox, though no error is raised.

dim StartDir as Directory
dim AllFiles() as String

AllFiles = StartDir.GetFiles("C:\Windows\System32")

'The following method works fine:
'Textbox1.Lines = AllFiles

'This method displays the problem.
dim TempString as String
For Each TempString in AllFiles
TextBox1.AppendText(TempString & ControlChars.CrLf)
Next

I can't find this documented anywhere, so assume it must be a bug. Anyone
have a similar experience, or know a workaround?

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


P: n/a
Hi,

That is all the info a textbox can hold. Use a richtextbox instead.

Ken
-------------------
"Andrew" <An****@discussions.microsoft.com> wrote in message
news:A2**********************************@microsof t.com...
VB .NET 2003, WinXP Pro:

Adding text to a text box with the TextBox.AppendText method limits the
amount of text in the textbox to 32K.

I have a short program that uses the GetFiles function of the directory
object, then iterates through the returned array and appends the strings to
the textbox. However, if the character count is greater than 32k, no
additional text is displayed in the textbox, though no error is raised.

dim StartDir as Directory
dim AllFiles() as String

AllFiles = StartDir.GetFiles("C:\Windows\System32")

'The following method works fine:
'Textbox1.Lines = AllFiles

'This method displays the problem.
dim TempString as String
For Each TempString in AllFiles
TextBox1.AppendText(TempString & ControlChars.CrLf)
Next

I can't find this documented anywhere, so assume it must be a bug. Anyone
have a similar experience, or know a workaround?
Nov 21 '05 #2

P: n/a


That's a known bug:

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>
"Andrew" <An****@discussions.microsoft.com> schrieb im Newsbeitrag
news:A2**********************************@microsof t.com...
VB .NET 2003, WinXP Pro:

Adding text to a text box with the TextBox.AppendText method limits the
amount of text in the textbox to 32K.

I have a short program that uses the GetFiles function of the directory
object, then iterates through the returned array and appends the strings
to
the textbox. However, if the character count is greater than 32k, no
additional text is displayed in the textbox, though no error is raised.

dim StartDir as Directory
dim AllFiles() as String

AllFiles = StartDir.GetFiles("C:\Windows\System32")

'The following method works fine:
'Textbox1.Lines = AllFiles

'This method displays the problem.
dim TempString as String
For Each TempString in AllFiles
TextBox1.AppendText(TempString & ControlChars.CrLf)
Next

I can't find this documented anywhere, so assume it must be a bug. Anyone
have a similar experience, or know a workaround?


Nov 21 '05 #3

P: n/a
"Andrew" <An****@discussions.microsoft.com> schrieb:
VB .NET 2003, WinXP Pro:

Adding text to a text box with the TextBox.AppendText method limits the
amount of text in the textbox to 32K.


That's a known bug:

<URL:http://groups.google.com/groups?selm=Ox0wQkDTDHA.2188%40TK2MSFTNGP10.phx.gb l>

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Nov 21 '05 #4

P: n/a
Why can't you add the files to a ListBox?

Dim strSystemDirectory As String =
Environment.GetFolderPath(Environment.SpecialFolde r.System)

ListBox1.Items.Clear()
For Each strFile As String In
IO.Directory.GetFiles(strSystemDirectory)
ListBox1.Items.Add(strFile)
Next

Crouchie1998
BA (HONS) MCP MCSE








"Andrew" <An****@discussions.microsoft.com> wrote in message
news:A2**********************************@microsof t.com...
VB .NET 2003, WinXP Pro:

Adding text to a text box with the TextBox.AppendText method limits the
amount of text in the textbox to 32K.

I have a short program that uses the GetFiles function of the directory
object, then iterates through the returned array and appends the strings to the textbox. However, if the character count is greater than 32k, no
additional text is displayed in the textbox, though no error is raised.

dim StartDir as Directory
dim AllFiles() as String

AllFiles = StartDir.GetFiles("C:\Windows\System32")

'The following method works fine:
'Textbox1.Lines = AllFiles

'This method displays the problem.
dim TempString as String
For Each TempString in AllFiles
TextBox1.AppendText(TempString & ControlChars.CrLf)
Next

I can't find this documented anywhere, so assume it must be a bug. Anyone
have a similar experience, or know a workaround?

Nov 21 '05 #5

P: n/a
Argh. I wish they would have posted this in the KB somewhere. I spent hours
trying to track this down, and since the documentation omits Windows XP (but
mentions every other OS for the past 10 years), I had to question whether or
not it was the code causing the problem. Thanks Herfried.

"Herfried K. Wagner [MVP]" wrote:
"Andrew" <An****@discussions.microsoft.com> schrieb:
VB .NET 2003, WinXP Pro:

Adding text to a text box with the TextBox.AppendText method limits the
amount of text in the textbox to 32K.


That's a known bug:

<URL:http://groups.google.com/groups?selm=Ox0wQkDTDHA.2188%40TK2MSFTNGP10.phx.gb l>

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Nov 21 '05 #6

P: n/a
I have to disagree with you, Ken. If I set the Text property of a textbox to
a string with 50,000 characters in it, it displays properly in the text box.
However, if I used the AppendText method to display the same string in the
text box, it would truncate to 32K characters.
-Andrew

"Ken Tucker [MVP]" wrote:
Hi,

That is all the info a textbox can hold. Use a richtextbox instead.

Ken
-------------------
"Andrew" <An****@discussions.microsoft.com> wrote in message
news:A2**********************************@microsof t.com...
VB .NET 2003, WinXP Pro:

Adding text to a text box with the TextBox.AppendText method limits the
amount of text in the textbox to 32K.

I have a short program that uses the GetFiles function of the directory
object, then iterates through the returned array and appends the strings to
the textbox. However, if the character count is greater than 32k, no
additional text is displayed in the textbox, though no error is raised.

dim StartDir as Directory
dim AllFiles() as String

AllFiles = StartDir.GetFiles("C:\Windows\System32")

'The following method works fine:
'Textbox1.Lines = AllFiles

'This method displays the problem.
dim TempString as String
For Each TempString in AllFiles
TextBox1.AppendText(TempString & ControlChars.CrLf)
Next

I can't find this documented anywhere, so assume it must be a bug. Anyone
have a similar experience, or know a workaround?

Nov 21 '05 #7

P: n/a
I could, but the point of the post wasn't so much to illustrate a particular
need as it was to demonstrate what I presumed must be a limitation of the
TextBox object.
The actual code where this was discovered was a bit more tedious, but the
code I posted here was just to demonstrate the problem.
-Andrew

"Crouchie1998" wrote:
Why can't you add the files to a ListBox?

Dim strSystemDirectory As String =
Environment.GetFolderPath(Environment.SpecialFolde r.System)

ListBox1.Items.Clear()
For Each strFile As String In
IO.Directory.GetFiles(strSystemDirectory)
ListBox1.Items.Add(strFile)
Next

Crouchie1998
BA (HONS) MCP MCSE








"Andrew" <An****@discussions.microsoft.com> wrote in message
news:A2**********************************@microsof t.com...
VB .NET 2003, WinXP Pro:

Adding text to a text box with the TextBox.AppendText method limits the
amount of text in the textbox to 32K.

I have a short program that uses the GetFiles function of the directory
object, then iterates through the returned array and appends the strings

to
the textbox. However, if the character count is greater than 32k, no
additional text is displayed in the textbox, though no error is raised.

dim StartDir as Directory
dim AllFiles() as String

AllFiles = StartDir.GetFiles("C:\Windows\System32")

'The following method works fine:
'Textbox1.Lines = AllFiles

'This method displays the problem.
dim TempString as String
For Each TempString in AllFiles
TextBox1.AppendText(TempString & ControlChars.CrLf)
Next

I can't find this documented anywhere, so assume it must be a bug. Anyone
have a similar experience, or know a workaround?


Nov 21 '05 #8

This discussion thread is closed

Replies have been disabled for this discussion.