473,666 Members | 2,047 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Error: Does not exist in the current context

Like my name says I am a total novice at C#. I am trying to following
examples in a book that I have but unfortunately they do not provide you with
code for the whole project. Up till now I could figure out what is causing
my problems but now I am stuck. I added in the books code into a Windows
Application:
using System;
using System.Collecti ons.Generic;
using System.Windows. Forms;

namespace WindowsApplicat ion1
{
class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
Application.Ena bleVisualStyles ();
Application.Set CompatibleTextR enderingDefault (false);
}

private void btnClickMe_Clic k(object sender, System.EventArg s e)
{
string msg = " ";
if (txtBeatle.Text == "John")
goto john;
if (txtBeatle.text == "Ringo")
goto ringo;
goto done;
john:
msg = "I like John best, too!";
goto done;
ringo:
msg = "Are you a drummer?";
goto done;
done:
if (msg != " ")
MessageBox.Show (msg, "Beatle choice",
MessageBoxButto ns.OK);
}

}
}
When I try to compile the code it displays an error ‘txtBeatle’ does not
exist in the current context. txtBeatle does not look like a variable
because it has .Text behind it. Could somebody be so kind as to tell what I
need to do to fix the problem.

Jun 27 '08 #1
2 3062
C#novice wrote:
private void btnClickMe_Clic k(object sender, System.EventArg s e)
{
string msg = " ";
if (txtBeatle.Text == "John")
When I try to compile the code it displays an error ‘txtBeatle’ does not
exist in the current context. txtBeatle does not look like a variable
because it has .Text behind it. Could somebody be so kind as to tell what I
need to do to fix the problem.
Is 'txtBeatle' a control in your main form? Then it should suffice to
move the btnClickMe_Clic k method into the code file of your form.

--

Martin Honnen --- MVP XML
http://JavaScript.FAQTs.com/
Jun 27 '08 #2
Much appreciated and thanks for your fast response!

Jun 27 '08 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
4739
by: Peter Frost | last post by:
Please help I don't know if this is possible but what I would really like to do is to use On Error Goto to capture the code that is being executed when an error occurs. Any help would be much appreciated. Thanks in advance
8
9449
by: Razak | last post by:
Hi, I have a class which basically do Impersonation in my web application. From MS KB sample:- ++++++++++++++++++++code starts Dim impersonationContext As System.Security.Principal.WindowsImpersonationContext Dim currentWindowsIdentity As System.Security.Principal.WindowsIdentity
5
6561
by: Bruce Schechter | last post by:
I just started to develop an ASP.NET application in vs.net 2003 . But each time I try to execute the application (which is basically empty so far), I get a dialog box titled "Microsoft Development Environment" with this message: "Error while trying to run project: Unable to start debugging on the web server. Server-side error occurred on sending debug HTTP request. Make sure the server is operating correctly. Verify there are no...
0
1306
by: dw | last post by:
Hi, all. I've deployed an ASP.NET 1.1 app from my localhost where it works fine to a server on the network, but when accessed from my machine through the Web, it first asks for me to log into the domain via a popup (which it shouldn't) and then generates this customErrors error, and then when I access the page from the server itself, it still does the popup and then generates the second error below. I think it's permissions on the folder,...
0
23483
by: HKSHK | last post by:
This list compares the error codes used in VB.NET 2003 with those used in VB6. Error Codes: ============ 3: This Error number is obsolete and no longer used. (Formerly: Return without GoSub) 5: Procedure call or argument is not valid. 6: Overflow. 7: Out of memory.
2
5605
by: aarepasky | last post by:
I am using ASP Web 2005 express and I have a textbox in a user control. Now when I try to use it in another user control, I get the error that it "does not exist in current context. These 2 user controls are each in a panel on the page. riprip
3
10818
by: namewitheldbyrequest | last post by:
"The XML element 'EnableTheming' from namespace 'http://tempuri.org/' is already present in the current scope" I created a Web Service: I imported System.Data.SqlClient so I could access SQL server tables programmatically. The web service builds and deploys with no problems. When I try to add the corresponding Web Reference to the Web Site project I get the error listed below. I am able to create other Web Services on the same server...
0
4356
by: dankyy1 | last post by:
hi ,i have an asp.net project runs on local intranet ,i use global.asax's onerror section to catch errors.so i got a simpleauth service does not exists error from some network clients .Error details are below.on my iis i have no virtual file such like this and nothing is installed like that. so what this error means? thanks. Error in: /SimpleAuthWebService/SimpleAuth.asmx Url: /SimpleAuthWebService/SimpleAuth.asmx Error Message: The...
0
3222
by: rbukkara | last post by:
Hi, I have got the following error while trying to add a user in the LDAP Directory. javax.naming.NameNotFoundException: ; remaining name 'uid=vassila,ou=People,dc=cs,dc=uno,dc=edu' I have given all the attributes which are needed, for the user, in the code and also the proper path where the user has to be added. Please have a look at my code CODE] // This is a class file which stores all the info required for the user
0
8783
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8552
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8640
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7387
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6198
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4198
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4369
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2011
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1776
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.