查找项目目录并在文件中写入 [英] Finding project directory and writing inside the file

查看:104
本文介绍了查找项目目录并在文件中写入的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





我在Visual Basic中有一个项目。我想让它能够被复制到另一台计算机,或存储在USB上。问题是项目写文件。



如何让程序找到自己的项目目录,然后写入这个文件?例如。对于远景它去C:\\Users \\ ...或者对于USB它找到usb目录的字符串,所以F:\\MyUSB \\ ...



非常感谢。

解决方案

我有全面的答案。注意与其他方法进行比较 - 并非所有方法都适用于所有情况。请看这些答案:

如何查找我的程序目录可执行目录),

如何查找我的程序目录当前目录,特殊文件夹



-SA

Hi,

I have a project in Visual Basic. I want to make it capable of being copied to a different computer, or stored on a USB. The issue is that the project writes files.

How do I get the program to find its own project directory, and then write to this file? E.g. for a vista it Goes C:\\Users\\... or for a USB it finds the string of the directory of usb so F:\\MyUSB\\...

Many thanks.

解决方案

I have the comprehensive answer. Pay attention for comparison with other methods — not all of them work correctly in all situations. Please see these answers:
How to find my programs directory (executable directory),
How to find my programs directory (current directory, "special folders").

—SA


这篇关于查找项目目录并在文件中写入的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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