VB.net中的文件参考

编程入门 行业动态 更新时间:2024-10-23 14:30:50
本文介绍了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中的文件参考

本文发布于:2023-11-04 05:30:11,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1557078.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:文件   VB   net

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!