Application.StartupPath

  • Thread starter Thread starter Sean
  • Start date Start date
S

Sean

Hi

I created a VB.NET console app. I try to use the Application.StartupPath()
but got an error: Name 'Application' is not declared. Any idea?

Thanks. Sean
 
Sean said:
I created a VB.NET console app. I try to use the Application.StartupPath()
but got an error: Name 'Application' is not declared. Any idea?

Either add a reference to "System.Windows.Forms.dll" and import the
'System.Windows.Forms' namespace in order to use 'Application.StartupPath'
or use the code below:

\\\
Imports System.IO
Imports System.Reflection
..
..
..
Private Function ApplicationPath() As String
Return _
Path.GetDirectoryName([Assembly].GetEntryAssembly().Location)
End Function
///
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top