本文介绍了VB中的文件参考的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在vb应用程序的硬盘驱动器中的某个位置创建了对文件的引用.
I created a reference to a file at some location in the hard drive in a vb application.
db_optb.Image = Image.FromFile("F:\Documents and Settings\Raza\My Documents\My Pictures\quiz_pics\opt_bg_post.jpg")程序执行正常. 但是,当我将整个项目文件夹移至另一台PC并执行该操作时,出现了文件不存在"异常. 绝对是该PC上没有该文件. 因此可以将文件放在项目中并以这样的方式引用它:将项目带到其他地方不会造成问题吗?
The program executed fine. But when i took the whole project folder to another PC and executed it there it gave a ''File does not exist'' exception. Definitely the file was not there in this PC. So can place the file in the project and refer it in such a way that taking the project to any other place does not create problems?
推荐答案将图像放入与EXE文件相同的文件夹,并使用以下命令: Put your images in the same folder as your EXE file and use the following : db_optb.Image = Image.FromFile("opt_bg_post.jpg")
更多推荐
VB.net中的文件参考
发布评论