如何获取.txt文件的值? [英] how to get a value of the .txt file?

查看:96
本文介绍了如何获取.txt文件的值?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要读取.txt文件,并且必须在文本框中显示该值.


hai dudes ............
帮帮我.........
怎么可能.............

i need to read the .txt file and i have to display that value in text box.


hai dudes............
help me.........
how can its possible.............

推荐答案

1.将文本文件读取为字符串.
2.将字符串设置为 TextBox.Text [^ ]属性.

您遇到哪部分困难?
1. read the text file into a string.
2. set the string into the TextBox.Text[^] property.

Which part of this are you having difficulty with?


如果文件的整个text 要显示在TextBox中,则可以使用以下方法
If the entire text from the file is to be displayed in the TextBox, then following method can be used
TextBox1.Text = System.IO.File.ReadAllText(fileName);


尝试此操作

如何:从文件中读取文本
[ ^ ]
try this

How to: Read Text from a File
[^]


这篇关于如何获取.txt文件的值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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