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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Variable Names change when saving 1

Status
Not open for further replies.

revilord

Programmer
Oct 2, 2003
64
We have several developers working on the same VB code. When one user makes a line change VB will automatically change several variable names.

For example moduleName becomes ModuleName or vice versa.

From what I understand VB will find the first variable with that name and change the case on another variable with that name. The problem is that the variable names keep getting switched back and forth every time a different developer commits there changes to the code base. this means that a one line code change will actually change 200 lines of code making tracking changes rather cumbersome.

Is there anyway to control this behavior so all developers will have the same variable names.

Thanks

Robert
 
It's where the variable is declared that determines the case of the letters.

Ultimately it doesn't affect the code as VB is case-insensitive.


 
>It's where the variable is declared that determines the case of the letters.

If only that were true ...

 
>It's where the variable is declared that determines the case of the letters

Not really, but I think where it was last declared, (In the case of control names affecting the case of identically named variables used in other routines, then maybe here it is the scope or when it was compiled, I do not know, because the control name seems to have preference.)

There is only one method I know of to prevent this: create a module-bas, separate from your project, which also includes all declarations in the desired case.
When you are ready to lock down the code for the day, load this module, hit F5, and then stop and unload the module.
 
So there is no checkbox setting in VB that says something like:

Arbitrarily rename variable []
or
Ask before renaming variables []

Actually I wouldn't even care if VB renamed the variables if it was consistent. Everyone is using the same setup and code why does it decide for one developer to name it moduleName and for another developer ModuleName.

 
I always change in the DIM statement. That updates everything.

-David
2006 & 2007 Microsoft Most Valuable Professional (MVP)
2006 Dell Certified System Professional (CSP)
 
I wonder if it could be possible to instruct "tracking changes software" be case-unsensitive, like VB itself?
I've heard there are used code formatters for similar reasons.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top