愚蠢的问题 - 如何从.NET获取app.path? [英] dumb question - How can I get the app.path from .NET?

查看:132
本文介绍了愚蠢的问题 - 如何从.NET获取app.path?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

VB.NET中app.path的等效语法是什么?

谢谢

Bill

解决方案

我通常把以下内容与声明...

Dim AppFolder As String =

System.Windows.Forms.Application.ExecutablePath .Su bstring

(0,

System.Windows.Forms.Application.ExecutablePath.La stIndexO

f(" \") + 1)


AppFolder然后指向你的exe文件的确切文件夹

从尾随\

运行 - ---原始消息-----
VB.NET中app.path的等效语法是什么?
谢谢
$



使用Deft Fingers,Bill Nguyen <双***************** @ jaco.com>写道:

VB.NET中app.path的等效语法是什么?




Dim appPath As String ''应用程序启动路径


appPath = System.Windows.Forms.Application.StartupPath


我认为你需要:


进口System.IO

问候,


布鲁斯


你在ExecutablePath属性上做得非常好:-)

但是,你可能不需要手动解析目录名,而是考虑使用System.IO来考虑
改为.Path类。

有些时候你的解析可能会失败 - 例如,如果

应用程序是从URL运行的。


-Rob Teixeira [MVP]


" CMG" < VB **** @ divx-warez.nl>在消息中写道

news:06 **************************** @ phx.gbl ... < blockquote class =post_quotes>我通常把以下内容与声明...
Dim AppFolder As String =
System.Windows.Forms.Application.ExecutablePath.Su bstring
(0 ,
System.Windows.Forms.Application.ExecutablePath.La stIndexO
f(" \")+ 1)

AppFolder然后指向你的确切文件夹exe从尾随\

-----原始消息-----
运行中的app.path的等效语法是什么? NET?
谢谢
$



what''s the equivalent syntax for app.path in VB.NET?
Thanks
Bill

解决方案

I usually put the following up with the declarations...
Dim AppFolder As String =
System.Windows.Forms.Application.ExecutablePath.Su bstring
(0,
System.Windows.Forms.Application.ExecutablePath.La stIndexO
f("\") + 1)

AppFolder then points to the exact folder ur exe is
running from with the trailing \

-----Original Message-----
what''s the equivalent syntax for app.path in VB.NET?
Thanks
Bill
.



With Deft Fingers, "Bill Nguyen" <bi*****************@jaco.com> wrote:

what''s the equivalent syntax for app.path in VB.NET?



Dim appPath As String '' Application Start Path

appPath = System.Windows.Forms.Application.StartupPath

And I think you need:

Imports System.IO
Regards,

Bruce


You were doing really well up to the ExecutablePath property :-)
However, rather than manually parsing out the directory name, you might want
to consider using the System.IO.Path class instead.
There are occassions where your parsing can fail - for example, if the
application was run from a URL.

-Rob Teixeira [MVP]

"CMG" <vb****@divx-warez.nl> wrote in message
news:06****************************@phx.gbl...

I usually put the following up with the declarations...
Dim AppFolder As String =
System.Windows.Forms.Application.ExecutablePath.Su bstring
(0,
System.Windows.Forms.Application.ExecutablePath.La stIndexO
f("\") + 1)

AppFolder then points to the exact folder ur exe is
running from with the trailing \

-----Original Message-----
what''s the equivalent syntax for app.path in VB.NET?
Thanks
Bill
.



这篇关于愚蠢的问题 - 如何从.NET获取app.path?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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