C#从txt文件读取数据
发布日期:2021-05-13 21:12:27 浏览次数:19 分类:精选文章

本文共 1623 字,大约阅读时间需要 5 分钟。

������txt���������������������

���D������������������txt���������������������������������������������,���������������������������������������������������������������������������GB2312������������������������������������������

������������

������������������������������������������������������������������������txt������������������������������������������������������������

private void Phone_Load(object sender, EventArgs e)
{
string ReadLine;
string[] array;
string Path = @"D:\FrontierApp.TXT";
StreamReader reader = new StreamReader(Path, System.Text.Encoding.GetEncoding("GB2312"));
while ((ReadLine = reader.ReadLine()) != null)
{
try
{
ReadLine = ReadLine.Replace("\"", "");
array = ReadLine.Split(',');
if (array.Length == 0)
{
MessageBox.Show("������������������������������������������������������������������");
return;
}
foreach (string item in array)
{
comboBox2.Items.Add(item);
}
}
catch (Exception ex)
{
MessageBox.Show("���������������������" + ex.Message);
}
}
}

������������

������������������������������������txt���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������

������������

������������������������������������txt���������������������������������������������������������������������������������������������

上一篇:如何判断数据类型?
下一篇:C#虚拟键盘

发表评论

最新留言

留言是一种美德,欢迎回访!
[***.207.175.100]2025年04月10日 08时23分32秒