Space Character in Naming

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,

VB6 permitted the use of the space character in naming when enclosed with square brackets. This was particularly useful when creating enumerations such as:

Enum FruitTypes
[Apples and Oranges]
[Bananas and Pears]
End Enum

I would like to do the equivalet in VB.NET. Not only would this be useful for enumerations, but also for property names used in the property grid control.

VB.NET does not seem to support use of the square brackets as in VB6. However, NO WHERE do I see whether there is an alternate way of doing this. NO WHERE do I see it documented what characters are allowed in VB.NET naming.

Does anyone know if this is possible in VB.NET. Also, can someone point me to something that documents what characters are permitted in VB.NET naming?

Thanks!

- Bob
 
* =?Utf-8?B?Qm9iIFF1aW5u?= said:
VB6 permitted the use of the space character in naming when enclosed
with square brackets. This was particularly useful when creating
enumerations such as:

Enum FruitTypes
[Apples and Oranges]
[Bananas and Pears]
End Enum

I would like to do the equivalet in VB.NET. Not only would this be
useful for enumerations, but also for property names used in the
property grid control.

I don't think that this is supported and I have never seen it in a .NET
component.
 
Bob,
As Herfried stated, Its not permitted.

The language specification for VB.NET can be found at:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vbls7/html/vbSpecStart.asp

Identifies specifically are defined at:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vbls7/html/vblrfVBSpec2_2.asp

Note: If the above links don't give the characters allowed directly, they
are in that section of MSDN!

The following describes what you can do for the Property Grid:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dndotnet/html/usingpropgrid.asp

Hope this helps
Jay



Bob Quinn said:
Hi,

VB6 permitted the use of the space character in naming when enclosed with
square brackets. This was particularly useful when creating enumerations
such as:
Enum FruitTypes
[Apples and Oranges]
[Bananas and Pears]
End Enum

I would like to do the equivalet in VB.NET. Not only would this be useful
for enumerations, but also for property names used in the property grid
control.
VB.NET does not seem to support use of the square brackets as in VB6.
However, NO WHERE do I see whether there is an alternate way of doing this.
NO WHERE do I see it documented what characters are allowed in VB.NET
naming.
Does anyone know if this is possible in VB.NET. Also, can someone point
me to something that documents what characters are permitted in VB.NET
naming?
 
I've been through all of that documentation and no where does it state what characters are acceptable for names nor is there any mention about the use of space one way or the other. I suspect, however, that you both are right. It just seems like somewhere there should be something that documents what characters are allowed

Thanks again

- Bo
 
Bob,
It just seems like somewhere there should be something that
documents what characters are allowed.
It is! Its on the page I gave you earlier!

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vbls7/html/vblrfVBSpec2_2.asp

Look at the Gray box at the bottom of the page. Which I have included
inline. The Gray box is in a BNF format (a form of Regular Expression).

Specifically the AlphaCharacter, NumericCharacter, CombiningCharacter,
FormattingCharacter and UnderscoreCharacter declarations, the other lines
indicate how these declarations are combined.

Identifier ::=
NonEscapedIdentifier [ TypeCharacter ] |
EscapedIdentifier
NonEscapedIdentifier ::= < IdentifierName but not Keyword >
EscapedIdentifier ::= [ IdentifierName ]
IdentifierName ::= IdentifierStart [ IdentifierCharacter+ ]
IdentifierStart ::=
AlphaCharacter |
UnderscoreCharacter IdentifierCharacter
IdentifierCharacter ::=
UnderscoreCharacter |
AlphaCharacter |
NumericCharacter |
CombiningCharacter |
FormattingCharacter
AlphaCharacter ::=
< Unicode alphabetic character (classes Lu, Ll, Lt, Lm, Lo, Nl) >
NumericCharacter ::= < Unicode decimal digit character (class Nd) >
CombiningCharacter ::= < Unicode combining character (classes Mn, Mc) >
FormattingCharacter ::= < Unicode formatting character (class Cf) >
UnderscoreCharacter ::= < Unicode connection character (class Pc) >
IdentifierOrKeyword ::= Identifier | Keyword

Now you need to know what Unicode classes are (Lu, Ll, Lt, Lm, Lo, Nl, Nd,
Mn, Mc, Cf, Pc), I normally refer to this page for that.
http://msdn.microsoft.com/library/d...temglobalizationunicodecategoryclasstopic.asp

I'm sure there are other pages that map the Unicode Classes to
characters in a more straight forward manner. Alternatively you can use the
Character Map in NT, 2000, and XP to "Group By" Unicode class to see
characters in just that class...

Hope this helps
Jay

Bob Quinn said:
I've been through all of that documentation and no where does it state
what characters are acceptable for names nor is there any mention about the
use of space one way or the other. I suspect, however, that you both are
right. It just seems like somewhere there should be something that
documents what characters are allowed.
 
Back
Top