Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 3.5 > ASP.NET 3.5 Basics
|
ASP.NET 3.5 Basics If you are new to ASP or ASP.NET programming with version 3.5, this is the forum to begin asking questions. Please also see the Visual Web Developer 2008 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 3.5 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old January 12th, 2010, 12:56 AM
Registered User
 
Join Date: Jan 2010
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default IDs can't start with a number

I have noticed that I cannot use a number in the beginning of an ID even though the book I am reading (Beginning ASP.NET 3.5) gives some example IDs in that format. Why is that?
 
Old January 12th, 2010, 02:47 AM
Friend of Wrox
 
Join Date: May 2004
Posts: 642
Thanks: 0
Thanked 43 Times in 42 Posts
Default

To use variables in your C# programs, you must know how to create variable names. In C#, variable names must adhere to the following rules:
  1. The name can contain letters, digits, and the underscore character (_).
  2. The first character of the name must be a letter. The underscore is also a legal first character, but its use is not recommended at the beginning of a name. An underscore is often used with special commands, and it's sometimes hard to read.
  3. Case matters (that is, upper- and lowercase letters). C# is case-sensitive; thus, the names count and Count refer to two different variables.
  4. C# keywords can't be used as variable names. Recall that a keyword is a word that is part of the C# language. (A complete list of the C# keywords can be found in Appendix B, "C# Keywords.")
Please check the following link on variables:
http://www.codeguru.com/csharp/sampl...le.php/c11387/
__________________
Om Prakash Pant
Click the "Thanks" button if this post helped you.
 
Old January 12th, 2010, 05:12 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Hi acr.repair,

Take a look at the errata for the book:

http://www.wrox.com/WileyCDA/WroxTit...Cd-ERRATA.html

You probably read lstFavoriteLanguage as firstFavoriteLanguage but is in fact listFavoriteLanguage. In other words, the first charcter is an lower case l as in List, not a 1 as in one or first.

Cheers,

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
 
Old January 12th, 2010, 02:18 PM
Registered User
 
Join Date: Jan 2010
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default another example

You are probably correct about that one, however, in Beginning ASP.NET 3.5, what about chapter 5 page 158 where it ants me to use the ID
"1stOperator". Am I reading that one correctly?
 
Old January 12th, 2010, 03:53 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Hi there,

The book uses lst (with an l as in list) exclusively. I know for sure, as I wrote it ;-)

However, because of the font used for the text, it may *appear* as if it's written with a 1.

In my upcoming .NET 4 version of this book, I am no longer using this prefix to avoid this confusion, but use FavoriteLanguageList instead.

Cheers,

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!





Similar Threads
Thread Thread Starter Forum Replies Last Post
ids dhoward VB.NET 2002/2003 Basics 4 December 17th, 2007 05:46 PM
Email IDs rohit_ghosh Excel VBA 2 July 16th, 2007 03:57 PM
Custom Generate IDs wackoyacky SQL Language 4 June 4th, 2007 08:53 AM
Dialog Help Ids sumeetpm Visual C++ 0 October 31st, 2006 03:19 PM
Assigning Record IDs dkspivey VB.NET 2002/2003 Basics 1 November 12th, 2004 12:39 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.