Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

The name does not exist

Posted on 2013-06-17
7
474 Views
Last Modified: 2013-06-17
Hi Experts!

Thanks for reading this.

Not sure what reference is missing for this error.

Does Not Exist in the current context
TIA!
0
Comment
Question by:allanau20
  • 5
  • 2
7 Comments
 
LVL 75

Expert Comment

by:käµfm³d 👽
ID: 39255133
The "My" namespace does not exist in C#. To get the application startup path, try using:

string strPath = Application.StartupPath;
0
 
LVL 5

Author Comment

by:allanau20
ID: 39255139
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
 
LVL 5

Author Comment

by:allanau20
ID: 39255146
tried ... Environment.CurrentDirectory ...
0
Webinar: Aligning, Automating, Winning

Join Dan Russo, Senior Manager of Operations Intelligence, for an in-depth discussion on how Dealertrack, leading provider of integrated digital solutions for the automotive industry, transformed their DevOps processes to increase collaboration and move with greater velocity.

 
LVL 5

Author Comment

by:allanau20
ID: 39255147
kaufmed; I need to step out for 4 hrs ... brb...
0
 
LVL 75

Accepted Solution

by:
käµfm³d   👽 earned 250 total points
ID: 39255149
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
 
LVL 5

Author Comment

by:allanau20
ID: 39255156
Oh.I see. I will try it soon. Thanks!
0
 
LVL 5

Author Closing Comment

by:allanau20
ID: 39255167
Thanks again and again!!
0

Featured Post

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …

860 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question