Link to home
Start Free TrialLog in
Avatar of Norma Posy
Norma PosyFlag for United States of America

asked on

VB automatically overrides my capitalization

I prefix string variables with "s", and integer variables with "i".
I made the mistake of dimensioning:
Dim sTR As String.
Instead of troubling to spell the variable out: sTableRuns

I have an integer:
Dim iTR As Integer.

iTR is computed. I wish to convert it to a string:

sTR = Str$(iTR)
But VB changes this to sTR$(iTR)

Realizing my mistake, I renamed the variables iTableRuns and sTableRuns.
But it is apparently too late.
Now, VB insists on re-formatting the function name Str$ to sTR$, and it doesn't work!

Help! What can I do?

I tried a global find and replace. It said it made the replacement, but it didn't.

There has got to be an option buried somewhere to turn this automatic editing feature off. I don't know where it is.
SOLUTION
Avatar of zorvek (Kevin Jones)
zorvek (Kevin Jones)
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Norma Posy

ASKER

zorvek: I did that. Didn't help. Good suggestion, though.

GrahamScan: You are correct. I've seen this happen before. When naming variables, stay away from reserved names. But there are a lot of those.

The moral is: Don't be lazy with abbreviated variable names.

kbirecki: Not trusting a global find-and-replace, I tediously went through the entire code, renaming that variable. Didn't help. Str stayed sTR. But today, when I reclaimed the code from Source Safe, the problem fixed itself!

SourceSafe probably has nothing to do with it. AFTER renaming the variable, storing, exiting, then re-loading seemed to do the trick.

Question: Is that "$" in "Str$()" necessary? I think it is a back-compatible thing for code written in the old Quick Basic", and the function itself works with or without the "$". Correct?

Thank you all for your help. I thought I was in deep trouble.

- - Norma
Yes, $ is optional.