• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 488
  • Last Modified:

The name does not exist

Hi Experts!

Thanks for reading this.

Not sure what reference is missing for this error.

Does Not Exist in the current context
TIA!
0
allanau20
Asked:
allanau20
  • 5
  • 2
1 Solution
 
käµfm³d 👽Commented:
The "My" namespace does not exist in C#. To get the application startup path, try using:

string strPath = Application.StartupPath;
0
 
allanau20Author Commented:
Thanks kaufmed.

Tried it, but it says:

The name 'Application' does not exist in the current context

Ctrl + '.' (period) suggests to add: System.Net.Mime.MediaTypeNames.Application
0
 
allanau20Author Commented:
tried ... Environment.CurrentDirectory ...
0
Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

 
allanau20Author Commented:
kaufmed; I need to step out for 4 hrs ... brb...
0
 
käµfm³d 👽Commented:
I took a stab that you were writing a Forms application. If you are, then that logic should work. If, however, you are writing a console application, then you won't have access to the Application class, and you have to do something like this:

using System.IO;
using System.Reflection;

...

string strPath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);

Open in new window


If this is a web application, then I would have to ask:  What do you need the startup path for?
0
 
allanau20Author Commented:
Oh.I see. I will try it soon. Thanks!
0
 
allanau20Author Commented:
Thanks again and again!!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

  • 5
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now