Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

C#

Arnas Misevicius
Arnas Misevicius
315 Points

The name `entry' does not exist in the current context

When I try to compile my program I get this error: Program.cs(19,15): error CS0103: The name `entry' does not exist in the current context What do I do?

Wade Williams
Wade Williams
24,476 Points

Can you link to the challenge and post your code? I'm guessing you're using 'entry' and it's either not instantiated, not in the scope you think it is or it's part of a class that has not been imported with a "using" directive.

1 Answer

Cheikh Faye Ndiaye
Cheikh Faye Ndiaye
7,298 Points

if you can post your code is better. but you must no one thing.

public void bar()
{
    var entry = "";
    entry = "something";
}

with this sample of code entry will only be accessible in the method bar().

you must do that:

var entry = "";
public void bar()
{
   entry = "something";
}