在VB 2008中应用的相对路径 [英] Relative Path to Application in VB 2008

查看:69
本文介绍了在VB 2008中应用的相对路径的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发的应用程序通过在表单加载事件中读取文本文件来填充列表框.目前,我的文件位于C:\中,这就是程序中的路径.
构建项目时,我希望文本文件与应用程序位于同一文件夹(或子文件夹)中,那么如何使路径相对?

即FileReader = New StreamReader(相对路径)

Paul

The application I''m developing populates list boxes by reading a text file at the form load event. At the moment I have the file located in C:\ and that''s the path in my program.
When I build the project I would like the text file to be in the same folder as the app (or a sub folder), so how do I make the path relative?

ie FileReader = New StreamReader(Relative Path)

Paul

推荐答案

您不知道.您查找启动路径,它是Application对象的属性.
You don''t. You look up the startup path, it''s a property of the Application object.


非常感谢.像魅力一样运作.
当你知道怎么做的时候就这么简单! 还在学习.
Thanks very much. Worked like a charm.
It''s so easy when you know how !!
Still learning.


这篇关于在VB 2008中应用的相对路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆