TextBox1.text = stringBuilderObject.ToString()

This code always return the first added character array only. How to return all charater arrays added to the String Builder?
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Éric MoreauSenior .Net ConsultantCommented:
How did you feed stringBuilderObject ? You should have used the .Append method. Show us your code.
f_asmaaAuthor Commented:
Dim sb As New StringBuilder()
Dim data(1024) As Char
Dim nBytes As Integer

  nBytes = sr.Read(data, 0, 1024)
Loop While nBytes = 1024

TextBox1.Text = sb.ToString

'sr is a stream reader
'TextBox1 only shows the first appended data. i.e the first 1024 characters. If I change 1024 into 2048 TextBox1 shows the first 2048 characters.
Éric MoreauSenior .Net ConsultantCommented:
change to
Loop While nBytes > 0
Cloud Class® Course: Microsoft Windows 7 Basic

This introductory course to Windows 7 environment will teach you about working with the Windows operating system. You will learn about basic functions including start menu; the desktop; managing files, folders, and libraries.

f_asmaaAuthor Commented:
No effect
Éric MoreauSenior .Net ConsultantCommented:
This code is working well for me:

            Dim read(256) As [Char]

            ' Read 256 charcters at a time    .
            Dim intCount As Integer = readStream.Read(read, 0, 256)
            Do While intCount > 0
                ' Dump the 256 characters on a string and display the string onto the console.
                Dim str As New [String](read, 0, intCount)
                intCount = readStream.Read(read, 0, 256)

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
f_asmaaAuthor Commented:
Yes your code works but I want to understand why do you use brackets around Char and String?
Éric MoreauSenior .Net ConsultantCommented:
You can remove them. That was copied from a website. These brackets are normally used when you need element names (variables, methods, enums, ...) with names that are normally invalids.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic.NET

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.