Click here to Skip to main content
15,911,306 members
Please Sign up or sign in to vote.
1.50/5 (2 votes)
See more:
I have a file test.txt. For example, its content includes multiple segments. And I have a form containing richTextBox1 and richTextBox2, I want one of the text file put in richTextBox1 and placed in the second set to richTextBox2. How I can? Thanks!
Posted
Updated 19-Dec-10 21:04pm
v2
Comments
Wild-Programmer 19-Dec-10 22:24pm    
Question is not clear. Please elaborate.
Sandeep Mewara 20-Dec-10 1:16am    
As said, your question is not quite clear. Please elaborate more on what you are trying to do.

1 solution

Well, that depends how you read that file.
You can do like this:

C#
String text = File.ReadAllText(@"C:\myTestament.txt");
String[] parts = text.Split(new String[] { "====SEGMENT SEPARATOR====" }, StringSplitOptions.RemoveEmptyEntries);
textBox1.Text = parts[0];
textBox2.Text = parts[1];
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900