Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

CamelHumpingProblemsWithEnums 1

Status
Not open for further replies.

Custom24

Programmer
Nov 27, 2001
591
GB
Hi
This sounds like a small problem, but it is annoying me

What I generally like to do is to (for example)

Dim strMyString as string 'note the camel humping case

and then type

strmystring = "Hello" 'note the lower case

when I press the return key, I get the reassurance of the camel humping automatically taking place, ie the VB editor changes my line to

strMyString = "Hello"

so I know that I've type the variable name correctly

(I use Option Explicit as well, it is nothing to do with Variable Delaration)

However, I've found that if I use enums, this stops working

Enum MyEnum
MyFirst = 1
MySecond
MyThird
End Enum

it works, but when I type one of the enums in code, it changes it all to lower case, including the declaration in the enum itself.

Where does the VB editor pick up which case to use and is there a way of making it select the same case as in the declaration?

Thanks
 
An Enum is a user defined constant. Try using this

Dim me as MyEnum

Then the VB editor will pick up the case when you assign the value to me

me = 'here the editor will pick up MyFirst, MySecond etc.

I hope that is what you are asking? Anything is possible, the problem is I only have one lifetime.
 
An Enum is a user defined constant. Try using this

Dim menm as MyEnum

Then the VB editor will pick up the case when you assign the value to menm

menm = 'here the editor will pick up MyFirst, MySecond etc.

I hope that is what you are asking? Anything is possible, the problem is I only have one lifetime.
 
Sorry,

You can't use the first post as 'me' is a keyword, my bad.
Anything is possible, the problem is I only have one lifetime.
 
Great when you are assigning, what about select statements or loops or if statements.

I also prefer Constants up front in conditionals (saves me from getting burned in C).

I find the control-space combo a handy tool. No solution to the humpelator but, gets me past well enough for now.

Type a little control-space pick one and get the right humps.




Wil Mead
wmead@optonline.net

 
Oh my God Wil - I never new about the CTRL Space!
It lists variables as well so I can go back to using longer variable names as well (I was starting to use intI and strMyStr to save me typing)
That's beautiful

Foada - thanks - the autocomplete works, but still if you just type in an enum constant in the wrong case without the autocomplete, all the occurences of the case change. It's only a minor problem so I'll get over it.

Mark
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top