text file import into a text control

Hi Guys,
             I need to be able to see a csv or txt file in a control the way we see it in NotePad or WordPad. Any ideas??

Thank you!
Serge
AutofreakAsked:
Who is Participating?
 
neilpriceCommented:

Hi Serge,

Try this;

Using System.IO;

...
System.IO.StreamReader sr = new System.IO.StreamReader("<your file name here>");
textBox1.Text = sr.ReadToEnd();
...

Hope it helps!
Neil
0
 
MuhammadAdilCommented:
0
 
AutofreakAuthor Commented:
Excellent Man, only I have used a richTextBox, textBox behaves as if it had a length limit for the string it displays and richTextBox doesn't.
0
Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
neilpriceCommented:
A TextBox has a MaxLength property which is probably the length limit you're hitting.
You can set this in the designer or in code to allow more input

Neil
0
 
AutofreakAuthor Commented:
Sorry Muhammadadil,
                         the article is awesome, thank you so much, sorry, but  I have already marked Neil's answer . I will make it up to you one day :)  I remember your articles about MDI forms. Hope to see your posts soon.

Regards
Serge
0
 
AutofreakAuthor Commented:
Thank you Neil,
talk to you soon
Serge
0
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.

All Courses

From novice to tech pro — start learning today.