Solved

The name does not exist

Posted on 2013-06-17
7
470 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
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.

 
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

In my previous two articles we discussed Binary Serialization (http://www.experts-exchange.com/A_4362.html) and XML Serialization (http://www.experts-exchange.com/A_4425.html). In this article we will try to know more about SOAP (Simple Object Acces…
This document covers how to connect to SQL Server and browse its contents.  It is meant for those new to Visual Studio and/or working with Microsoft SQL Server.  It is not a guide to building SQL Server database connections in your code.  This is mo…
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

786 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