473,322 Members | 1,287 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

Using VB Keywords In An Enum Statement

I am creating an enumeration that is very similar to the DayNameFormat
enumeration. The 5 members I want are None, Full, Short, FirstLetter, and
FirstTwoLetters. Because Short is a VB.NET keyword, I am recieving an error
when creating the enumeration. My code is currently as follows:

Public Enum DayNameStyle
None
Full
Short
FirstLetter
FirstTwoLetters
End Enum

I know that there must be some way to avoid this error (they must have done
it somehow when creating DayNameFormat, and I am assuming the VB.NET
creators must have thought of this when creating VB.NET. Any ideas? Thanks.
--
Nathan Sokalski
nj********@hotmail.com
http://www.nathansokalski.com/
Nov 21 '05 #1
1 1637
Nathan,
You need to escape the identifiers in [], something like:

Public Enum DayNameStyle
None
Full
[Short]
FirstLetter
FirstTwoLetters
End Enum

For details on escapied identifiers see:

http://msdn.microsoft.com/library/de...fVBSpec2_2.asp

--
Hope this helps
Jay [MVP - Outlook]
T.S. Bradley - http://www.tsbradley.net
"Nathan Sokalski" <nj********@hotmail.com> wrote in message
news:ui*************@tk2msftngp13.phx.gbl...
|I am creating an enumeration that is very similar to the DayNameFormat
| enumeration. The 5 members I want are None, Full, Short, FirstLetter, and
| FirstTwoLetters. Because Short is a VB.NET keyword, I am recieving an
error
| when creating the enumeration. My code is currently as follows:
|
| Public Enum DayNameStyle
| None
| Full
| Short
| FirstLetter
| FirstTwoLetters
| End Enum
|
| I know that there must be some way to avoid this error (they must have
done
| it somehow when creating DayNameFormat, and I am assuming the VB.NET
| creators must have thought of this when creating VB.NET. Any ideas?
Thanks.
| --
| Nathan Sokalski
| nj********@hotmail.com
| http://www.nathansokalski.com/
|
|
Nov 21 '05 #2

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

Similar topics

3
by: Berteun Damman | last post by:
Hello, I'm having some problems with pyparsing, I could not find how to tell it to view certain words as keywords, i.e. not as a possible variable name (in an elegant way), for example, I have...
11
by: Grasshopper | last post by:
Hi, I am automating Access reports to PDF using PDF Writer 6.0. I've created a DTS package to run the reports and schedule a job to run this DTS package. If I PC Anywhere into the server on...
13
by: Adam Blair | last post by:
Is it possible to bind a switch statement to an Enum such that a compile-time error is raised if not all values within the Enum are handled in the switch statement? I realise you can use default:...
31
by: Michael C | last post by:
If a class inherits from another class, say Form inherits from control, then I can assign the Form to a variable of type Control without needing an explicit conversion, eg Form1 f = new Form1();...
10
by: Rick Palmer | last post by:
I have an app I'm working on that will allow a user to run one of 5 reports. The report names are in a combobox on my form. I have a sub defined for each report that has the exact same name as is...
9
by: Nenad Loncarevic | last post by:
I am a geologist, and over the years I've accumulated quite a number of proffesional papers on the subject, in various publications. I would like to make a database that would help me find the...
6
by: ronrsr | last post by:
but I keep getting syntax errors on this one - adict = {'zid': result, 'keywords': result{0], 'quotations':result,'citations':result{3]}; zhtml.print_update_form(adict); result = 22L
9
by: subramanian | last post by:
Hello. Consider the following code fragment : enum TestEnum { val1 = 10, val2 = 100, val3 = 1000 }; class Test { public : enum TestEnum { val1 = 1, val2 val3 }; Test(int i = 0, int j = 0,...
2
by: Toe001 | last post by:
Please help - I would like to pass to the routine MUX(Input, Phase) where Input is 0,1 and Phase 0,1,2 depending if the user presses the key (V,I) and (R,W,B) on the serial terminal. I can not...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.