如何引用外部.txt文本文档在窗体中的文本框中显示.txt中的内容?
应该怎么写这样的程序?
应该怎么写这样的程序?
解决方案 »
- notifyIcon 控件的ShowBalloonTip方法里能添加链接吗
- label.Image出现低概率显示错误!已经困扰了多天,望高人指点
- 请教下 如何将文本附件上传到SQL数据库中 请注意 是到数据库中 不是到虚拟目录下!给个思路就散分
- webrequest和axwebbrowser可以配合一起用吗
- SOCKET长连接问题解决
- 怎么在Windows中查找到我的文档,图片收藏等这些文件夹的路径??
- C#操作Excel的问题
- 急!急!!急!!!sharpmap开发在添加层的时候,怎么把后面的层都看不到了!!是前面的层把后面的给遮住了还是把后面的层给移除了???!!!!
- Winform中,系统是否提供了直接获取Mouse状态的方法?
- 能不能在两个项目之间传递cookie?
- 谁给我解释下,急急急!!!!!
- DataSet 更新数据是出现问题
StreamReader objReader = new StreamReader(HttpContext.Current.Server.MapPath("用户协议.txt"), System.Text.Encoding.Default);
string str = objReader.ReadToEnd();
objReader.Close();str就是你要的内容
StreamReader hc = new StreamReader(@"C:\database.sql");
string ss = hc.ReadToEnd();
this.richTextBox1.Text = ss.ToString();
using System.Collections.Generic;
using System.Text;
using System.IO;
namespace ConsoleApplication14
{
class Program
{
static void Main(string[] args)
{
FileStream fs = new FileStream("C:\\list.txt", FileMode.Open, FileAccess.Read);
StreamReader sr = new StreamReader(fs);
string str = sr.ReadToEnd();
Console.WriteLine(str);
}
}
}
private string Read( string file )
{ StreamReader reader = new StreamReader( file );
string data = reader.ReadToEnd ();
reader.Close(); return data;
} string data = Read( @"c:\temp.txt" );
textBox1.Text = data;
st = new System.IO.StreamReader(filepath, System.Text.Encoding.ASCII);
TextBox1.Text = st.ReadLine();
st.Close();