求教!在ListBox中载入指定目录下的表文件(在Pocket PC上)

bethrezen 2003-03-25 12:57:21
在WindowsApplication下 ,用下列代码:
ListMapName.Items.Clear();
StreamReader sr = new StreamReader("E:\test\k\map.res");
string str;
while((str=sr.ReadLine())!=null)
{
ListMapName.Items.Add(str);
}
能实现功能,但在SmartDeviceApplication上却不能!
显示的错误为An unhandled exception of type 'System.IO.DirectoryNotFoundException' occurred in mscorlib.dll

Additional information: DirectoryNotFoundException。
有什么别的解决办法吗?

...全文
30 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
bethrezen 2003-03-25
  • 打赏
  • 举报
回复
没有啦!我也是刚学着用!是在SmartDeviceApplication的情况下做的!有什么问题吗?
Knight94 2003-03-25
  • 打赏
  • 举报
回复
pocket pc是否有“E:\test\k\map.res”这个文件?
bethrezen 2003-03-25
  • 打赏
  • 举报
回复
错误停在StreamReader sr = new StreamReader("E:\test\k\map.res");
Knight94 2003-03-25
  • 打赏
  • 举报
回复
try
{
StreamReader sr = new StreamReader("E:\test\k\map.res");
}
catch(Exception e)
{
MessageBox.Show(e.Message);
}
banping 2003-03-25
  • 打赏
  • 举报
回复
呵呵!
pocket pc上不支持!

不对!!错误停在那一行??
在ListMapName.Items.Add(str);??看一下str值是多少??
看看是不是文件问题??

110,537

社区成员

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

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

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