请问怎么把一个文本文件理的内容显示到一个listbox中,有没有快速的方法,谢谢!

CACACAW 2005-11-17 04:48:33
...全文
56 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
desailly 2005-11-17
  • 打赏
  • 举报
回复
up
ChengKing 2005-11-17
  • 打赏
  • 举报
回复
参考:

string tempStr=null; StreamReader sr = new StreamReader(FileName,System.Text.Encoding.Default);while(tempStr!=battle&&(tempStr=sr.ReadLine())!="[结束]"); if(tempStr.Equals("[结束]")) return; //找不到旗局名称,则退出
tempStr=sr.ReadLine(); //略过战役名称
tempStr=tempStr.Trim();
int index=0;
while(!tempStr.Equals("[END]"))
{
string[] str=new string[9];
str=tempStr.Split(' ');
foreach(string str1 in str)
{
string str2;
str2=str1.Trim();
if(str1.CompareTo(" ")>0)
soldiers[index++]=str2;
}
tempStr=sr.ReadLine();
}
for(int i=0;i<32;i++)
{
if(soldiers[i]!="NULL")
{
this.pictureBoxs[i].Image=(Image)myHT[soldiers[i]];
continue;
}
this.pictureBoxs[i].Visible=false;
}
sr.Close();

110,538

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧