How to read file with custom extension to textBox
Is there any way to read file with custom extension to textBox? Is there 开发者_运维知识库any convertation to some supported formats?
I need read file with custom extension, like text.blahblahblah
.
Is there any way to read file with custom extension to textBox?
Sure, just load the file text to the TextBox
like:
textBox1.Text = File.ReadAllText(@"Your input file path");
You can let the user choose the file using OpenFileDialog
and specify a format accepted in the dialog filter.
If you want to also read rtf
text then I think you need a RichTextBox
instead of TextBox
here so you can read rtf
text probably using richTextBox1.Rtf
string.
精彩评论