C# - Read .txt file into TextBox

你离开我真会死。 提交于 2019-11-29 11:23:00

if you just need the complete text, you should use the function File.ReadAllText - pass it the FileName/Path selected in the dialoge (openFileDialog1.FileName).

to load for example the content into a textbox, you can write:

 textbox1.Text = File.ReadAllText(openFileDialog1.FileName);

opening and using streams is a little bit more complicated, for that you should look up the using - statement

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!