选项文字 [英] Option text

查看:128
本文介绍了选项文字的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个文件test.txt.例如,其内容包括多个细分.我有一个包含richTextBox1和richTextBox2的表单,我希望将其中一个文本文件放入richTextBox1中,然后将第二个文本文件放入richTextBox2中.我怎么能?谢谢!

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!

推荐答案

好吧,这取决于您读取该文件的方式.
您可以这样:

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

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];


这篇关于选项文字的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆