path.GetFullPath and form maximum height

danyeungw

Well-known member
Joined
Aug 30, 2005
Messages
73
Programming Experience
10+
I have two questions:

First, according to this link http://msdn2.microsoft.com/en-us/library/system.io.path.getfullpath.aspx, path.GetFullPath should get the full path where my application is located. But when I use
path.GetFullPath("\") is my application, I got only "C:\". Why?

Second, I want the form can be sized the width but not the height in run time. The form original size is width 498 and height 188. When I type 188 in the height maximum size, the form width size automatically changed to 122 and not allow my to type in 498 in design mode. What did I miss?

Thanks.
DanYeung
 
GetFullPath gets the full absolute path for a given partial path. So GetFullPath("\") should return "C:\" assuming you're current directory is on C:.

I think what you want is Application.ExecutablePath

I'm not sure about the second part. To enforce maximum heights in VB6 I used to check check height in Resize and set to my maximum if it was more than that. Not sure about VB.NET. Hopefully someone else can help with that one.
 
When I execute this line of code:

VB.NET:
MsgBox(Application.ExecutablePath)

I see the path to my exe in a message box.

I am fairly new to VB.NET, just trying to help. Perhaps a more experienced user can help?
 
Last edited by a moderator:
If you only want the path without the executable filename you can go with the StartupPath property of Application class.
 
Is ExecutablePath in your app.config file?

DanYeung

Not that I know of. I didn't even know I had an app.config file. (Told you I'm new! :))

I see you're on Version 1.1 of the Framework. I'm on 2.0 (vs.net 2005). Maybe it's a new property? But surely there must be something simliar. In VB6 they had App.Path.
 
What do I have to import in order by get Application.StartupPath and / or Application.ExecutablePath? I got "StartupPath is not
System.Web.HttpApplicationState". I indcluded the following imports:

Imports
System.Web
Imports System.Web.HttpApplication
Imports System.Web.HttpApplicationState

What did I miss?

Thanks.
DanYeung
 
For ASP.Net can do code server.mappath(".")
Be sure to ask in appropriate forum, winapps and webapps are very different.
 
Sorry, I was asking winapp. I just happened to tried on the webapp last. There is no IntelliSense for application in a winapp. What do I miss?

Thansk.
DanYeung
 
As you know the Application class is from System.Windows.Forms namespace, so perhaps your winapp project is not a winforms project? :)
 
Back
Top