VB6 Editor changing case of variable names

Continuing from DJ's answer...

And it won't only change the case of variables in the same scope either.

It will change the case of all variables with the same name in your entire project. So even if they're declared in uppercase in one place, another module might have different variables using the same variable names in lowercase, causing all variables in your project to change to lowercase, depending on which of the declarations was loaded (?) or edited last.

So the reason your C and X variables are changing case, while the Y isn't, is probably because C and X are declared somewhere else in your project too, but in lowercase, while Y isn't.

There's another mention of it here, where they mostly seem concerned with such variable names conflicting when case is being used to differentiate local from global variables. They end up going for prefixes instead.

The only alternative I can think of is to use some other editor with VB6-highlighting capabilities to do your editing...


To get past the painful file diff experience, set the VSS option in the diff dialog to do case-insensitive comparisons. That way you'll only see the "real" changes.


Since I always find this thread first looking for a solution to messed-up casing, here is one Simon D proposed in a related question:

If you just need to fix one variable's casing (e.g. you accidentally made a cOrrectCAse variable and now they are all over the place), you can correct this for good by adding

#If False Then
    Dim CorrectCase
#End If

to the beginning of your module. If you save the project and remove the statement later, the casing remains correct.

Using Excel VBA I often accidentally change all Range.Row to Range.row by carelessly dimming a row variable inside some function - with the help of Simon D's solution I can fix this now.


Enums are even worse. Getting the case wrong anywhere the enum is used changes the case of the definition.

Tags:

Ide

Vb6