在VB.NET中,如何为模板设置通用文件目录,以便我不更改每个最终用户的文件目录 [英] In VB.NET how do I set a universal file directory for templates so that I am not changing the file directory for each end user

查看:69
本文介绍了在VB.NET中,如何为模板设置通用文件目录,以便我不更改每个最终用户的文件目录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的问题是我有我的软件的excel模板,每次我为新计算机发布软件时,我都必须更改模板位置的文件目录。我希望有一个位置来存储这些模板,这样我只需要指向它们一次。



我尝试了什么:



我已将excel模板添加到我的解决方案资源管理器中,并且一直试图指向解决方案资源管理器中的位置无济于事。我目前为每台运行软件的计算机都有单独的文件目录字符串,并注释掉我不需要为特定用户选择文件扩展名的文件。

解决方案

< blockquote>永远不要使用像这样的硬编码路径名,这只会导致问题。另外,您不是指文件扩展名; Excel数据文件在所有系统上使用相同的扩展名,即.xls,.xlsx等。您需要的是一种查找每台PC上将存在的公共路径的简单方法。 OriginalGriff写了一篇关于这个主题的优秀文章:我应该在哪里存储我的数据? [ ^ ]。唯一的问题是您很可能需要使用您的应用程序名称和版本而不是动态GUID。


My problem is I have excel templates that go with my software and I have to change the file directory for the location of the Templates every time I publish the software for a new computer. I would like to have a single location to store these templates so that I only have to point to them once.

What I have tried:

I have added the excel template to my solution explorer and have been trying to point to the location in the solution explorer to no avail. I currently have separate file directory strings for each computer that the software will run on and comment out the ones I don't need to select file extension for the specific user.

Never use hard coded path names like this, it just leads to problems. Also, you do not mean file extensions; Excel data files use the same extensions on all systems, i.e. .xls, .xlsx, etc. What you need is a simple way of finding a common path that will exist on every PC. OriginalGriff has written an excellent article on the subject: Where should I store my data?[^]. The only issue with that is that you most likely need to use your application name and version instead of a dynamic GUID.


这篇关于在VB.NET中,如何为模板设置通用文件目录,以便我不更改每个最终用户的文件目录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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