|
-
Nov 2nd, 2005, 06:51 AM
#1
Thread Starter
Frenzied Member
Capitalisation (or capitalization)
I'm working on a large application made up of a number of different projects all loaded in the IDE at the same time.
Quite often VB's context-sensitive auto-complete feature changes the capitalisation of variables/method names. Has anyone had this experience and, more importantly does anyone know how to fix it?
What I'm talking about is if you have a method called "ID" in a class sometimes VB will change it to "Id" where you use it (e.g. MyObject.Id) and every time you try to correct the capitalisation it won't let you.
We use VSS to store our source code. When the code comes out of VSS it has correct capitalisation (I checked it using Notepad). However, when it's loaded into VB's IDE it goes screwy.
Hope this makes sense? I've spent all morning trying to sort it out. Any help would be appreciated.
I'm wondering if the VB attributes in the .frm files (e.g. "Attribute VB_PredeclaredId = False") have anything to do with it?
This world is not my home. I'm just passing through.
-
Nov 2nd, 2005, 07:30 AM
#2
Addicted Member
Re: Capitalisation (or capitalization)
Woulden't a "Option Explicit" take care of it? Or am I way of track? But as to WAY it happens, I sadly don't have an answer
-
Nov 2nd, 2005, 07:37 AM
#3
Thread Starter
Frenzied Member
Re: Capitalisation (or capitalization)
Woulden't a "Option Explicit" take care of it?
Sadly, no.
Option Explicit forces you to declare your variables (which is a very good thing. My problem is that VB is automatically changing the case of my variable and method names.
If you declare a public variable "MyVariable As Long" in your form then you can type myvarIABLE elsewhere in your code and VB automatically corrects it to "MyVariable". What I'm getting is that VB is chaning the capitalisation incorrectly - even though I have declared the variable as required and even type it correctly VB still changes it to the wrong case.
This world is not my home. I'm just passing through.
-
Nov 2nd, 2005, 07:39 AM
#4
Re: Capitalisation (or capitalization)
 Originally Posted by trisuglow
If you declare a public variable "MyVariable As Long" in your form then you can type myvarIABLE elsewhere in your code and VB automatically corrects it to "MyVariable".
This I have had happen, and in fact, I count on it. When I type out a variable, I always type it out in all lower case and wait to see if VB will correct it for me. If it does, then I know I typed the variable name correctly.
 Originally Posted by trisuglow
What I'm getting is that VB is chaning the capitalisation incorrectly - even though I have declared the variable as required and even type it correctly VB still changes it to the wrong case.
This I have never had happen, or seen happen.
-
Nov 2nd, 2005, 08:58 AM
#5
Addicted Member
Re: Capitalisation (or capitalization)
 Originally Posted by trisuglow
Sadly, no.
Option Explicit forces you to declare your variables (which is a very good thing. My problem is that VB is automatically changing the case of my variable and method names.
If you declare a public variable "MyVariable As Long" in your form then you can type myvarIABLE elsewhere in your code and VB automatically corrects it to "MyVariable". What I'm getting is that VB is chaning the capitalisation incorrectly - even though I have declared the variable as required and even type it correctly VB still changes it to the wrong case.
My bad! Still, strange stuff
-
Nov 2nd, 2005, 09:26 AM
#6
Re: Capitalisation (or capitalization)
I've experienced this many times. But I just ignore it as it doesn't make any difference. VB is case-insensitive.
Pradeep
-
Nov 2nd, 2005, 09:31 AM
#7
Thread Starter
Frenzied Member
Re: Capitalisation (or capitalization)
I've experienced this many times. But I just ignore it as it doesn't make any difference. VB is case-insensitive.
You're right, but we want to keep our code tidy and make it easy to read. Do you have any ideas at all that might help?
This world is not my home. I'm just passing through.
-
Nov 2nd, 2005, 09:55 AM
#8
Re: Capitalisation (or capitalization)
 Originally Posted by trisuglow
You're right, but we want to keep our code tidy and make it easy to read. Do you have any ideas at all that might help?
What I have observed is that if you have a variable name with the same name as the property/method (just cases different) it misbehaves.
So whenever I correct the case of the variable name, it starts working properly.
Try this:
At form level type Dim ID
Observe that the property/method ID has been capitalized correctly.
Now delete the line you added and save the project.
Pradeep
-
Nov 2nd, 2005, 10:36 AM
#9
Thread Starter
Frenzied Member
Re: Capitalisation (or capitalization)
Pradeep, I've tried this and it looks like it could be a top tip. I'll see what happens and report back...
This world is not my home. I'm just passing through.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|