使用StreamReader读取,让后放到数据或者dataTable里,再循环赋值给textbox。
解决方案 »
- 无法加载为扩展“contextPropagationElement”注册的类型 请问如何加载呢???
- 怎样弹出提示窗口
- c#调用压缩程序
- 请问 Winamp 的活泼界面是如何制作?
- BinaryFormatter序列化大容量数据, 会产生System.OutOfMemoryException异常
- 那里出错了
- C#中string 类型的比较??
- 本团队找志同道合的朋友一起开发搜索程序(c# OR java)!提供我们写好的一部分搜索代码给大家研究!
- 在业务逻辑层与数据库之间编写组件 谁有好一点的例子
- 高手请看一下,关于.net文件读写格式的问题!
- 想请教C#加密解密图片的问题
- C#winform 窗体程序想做出类似于qq空间里查看图片的效果
/// <summary>
/// 根据Txt文件读取赋值
/// 5,10
/// 15,20
/// 25,30
/// </summary>
/// <param name="filePath"></param>
/// <returns></returns>
private List<string> ReadTxt(string filePath)
{
StreamReader sReader = new StreamReader(filePath, Encoding.Default);
List<string> listValue = new List<string>(); //读取行
string strLine = sReader.ReadLine(); while (!string.IsNullOrEmpty(strLine))
{
if (strLine.Contains(','))
{
string[] stemp = strLine.Split(',');
listValue.Add(stemp[0]);
listValue.Add(stemp[1]);
}
else
{
listValue.Add(strLine);
} strLine = sReader.ReadLine();
} return listValue;
}