VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



Enumeration Spelling

by ULLI (93 Submissions)
Category: OLE/COM/DCOM/Active-X
Compatability: Visual Basic 5.0
Difficulty: Beginner
Date Added: Wed 3rd February 2021
Rating: (9 Votes)

How to keep the upper/lower case of Enumeration members

Rate Enumeration Spelling

Option Explicit
'Due to a bug in VB members of an Enumeration do
'not keep their upper/lower case when they are
'typed differently in code. There is a simple
'solution however. All you have to do is repeat
'the'member names with their proper spelling and 
'case bracketed by
#If False Then
#End If
'as the following example shows:
Public Enum TTStyle
  TTStandardIfActive = TTS_STANDARD
  TTBalloonIfActive = TS_BALLOON
  TTStandardAlways = TTS_STANDARD Or TTS_ALWAYSTIP
  TTBalloonAlways = TTS_BALLOON Or TTS_ALWAYSTIP
  TTNone = -1
End Enum
#If False Then
Private TTStandardIfActive, TTBalloonIfActive, TTStandardAlways, TTBalloonAlways, TTNone 'to preserve the case
#End If

Download this snippet    Add to My Saved Code

Enumeration Spelling Comments

No comments have been posted about Enumeration Spelling. Why not be the first to post a comment about Enumeration Spelling.

Post your comment

Subject:
Message:
0/1000 characters