Am I going insane...? 
Author Message
 Am I going insane...?

I posted about week or so ago about how variables would auto un-cap
themselves for no apparent reason. Well to make sure I wasn't going
insane I JUST loaded a single module from my larger app. I made 100%
sure the variable WAS NOT globally declared.

Now, take these code for example... in VB 6.0 sp5 if I capitalize the
first X in "Dim x As Integer" in ClearDataLists I notice the X in the
For/Loop, in FindSlot, also becomes capitalizied!!!!

I am baffled!!!!

Thanks.

'------------------------------------------------------------------------------------

Private Sub ClearDataLists()

  Dim x As Integer

  For x = 0 To MAX_DATA_LISTS
    DataList(x).isEmpty = 1
    DataList(x).UserID = ""
    DataList(x).ArmyID = ""
    DataList(x).FileNm = ""
  Next x

End Sub

Public Function FindSlot(toFind As Integer) As Integer

  Dim x As Integer

  For x = 0 To MAX_ENTRIES
    If toFind = Army(x).isEmpty Then
      FindSlot = x
      Exit Function
    End If
  Next x

End Function



Thu, 11 Nov 2004 15:21:05 GMT  
 Am I going insane...?
Peter

I read your earlier posts, seemed strange, but in the example you posted,
capitalizing the x in any declare statemement anywhere in your project would
capitalze every x anywhere in your project. I would even guess it would
capitalize even the x's in other projects if you loaded them together in the
ide. Seems to be designed that way.

Note that vb doesn't care much about capitalisation anyway.

Cees Harlaar


Quote:
> I posted about week or so ago about how variables would auto un-cap
> themselves for no apparent reason. Well to make sure I wasn't going
> insane I JUST loaded a single module from my larger app. I made 100%
> sure the variable WAS NOT globally declared.

> Now, take these code for example... in VB 6.0 sp5 if I capitalize the
> first X in "Dim x As Integer" in ClearDataLists I notice the X in the
> For/Loop, in FindSlot, also becomes capitalizied!!!!

> I am baffled!!!!

> Thanks.

'---------------------------------------------------------------------------
---------
Quote:

> Private Sub ClearDataLists()

>   Dim x As Integer

>   For x = 0 To MAX_DATA_LISTS
>     DataList(x).isEmpty = 1
>     DataList(x).UserID = ""
>     DataList(x).ArmyID = ""
>     DataList(x).FileNm = ""
>   Next x

> End Sub

> Public Function FindSlot(toFind As Integer) As Integer

>   Dim x As Integer

>   For x = 0 To MAX_ENTRIES
>     If toFind = Army(x).isEmpty Then
>       FindSlot = x
>       Exit Function
>     End If
>   Next x

> End Function



Thu, 11 Nov 2004 16:06:24 GMT  
 Am I going insane...?

Quote:

> I posted about week or so ago about how variables would auto un-cap
> themselves for no apparent reason. Well to make sure I wasn't going
> insane I JUST loaded a single module from my larger app. I made 100%
> sure the variable WAS NOT globally declared.

> Now, take these code for example... in VB 6.0 sp5 if I capitalize the
> first X in "Dim x As Integer" in ClearDataLists I notice the X in the
> For/Loop, in FindSlot, also becomes capitalizied!!!!

> I am baffled!!!!

> Thanks.

> '------------------------------------------------------------------------------------

> Private Sub ClearDataLists()

>   Dim x As Integer

>   For x = 0 To MAX_DATA_LISTS
>     DataList(x).isEmpty = 1
>     DataList(x).UserID = ""
>     DataList(x).ArmyID = ""
>     DataList(x).FileNm = ""
>   Next x

> End Sub

> Public Function FindSlot(toFind As Integer) As Integer

>   Dim x As Integer

>   For x = 0 To MAX_ENTRIES
>     If toFind = Army(x).isEmpty Then
>       FindSlot = x
>       Exit Function
>     End If
>   Next x

> End Function

Peter,

As stated before (IIRC), auto-capitalization is independent of variable
scope. It seems that VB does a global text replace throughout the
project whenever you change a variable's letter case.

I'm not sure about the answer to the subject question of this post, but
I think this VB "feature" has nothing to do with you going insane... ;)
[OTHO, is it one of the things that MAKES you go insane?]

Yaniv.



Thu, 11 Nov 2004 16:09:20 GMT  
 Am I going insane...?
The same holds true for any variable .. ie dim a var called index (low case)
and references to Index in control events also change case. Remember, in
previous versions of Basic x and X were two different variables, which is
now not the case. So VB is just applying a uniformity to all vars with the
same name throughout the project. It may be annoying, but is nothing more
than that.

If that's your only problem, you are indeed a lucky guy <g>.

--

Randy Birch
MVP Visual Basic
http://www.mvps.org/vbnet/
Please respond only to the newsgroups so all can benefit.


Quote:
> I posted about week or so ago about how variables would auto un-cap
> themselves for no apparent reason. Well to make sure I wasn't going
> insane I JUST loaded a single module from my larger app. I made 100%
> sure the variable WAS NOT globally declared.

> Now, take these code for example... in VB 6.0 sp5 if I capitalize the
> first X in "Dim x As Integer" in ClearDataLists I notice the X in the
> For/Loop, in FindSlot, also becomes capitalizied!!!!

> I am baffled!!!!

> Thanks.

'---------------------------------------------------------------------------
---------
Quote:

> Private Sub ClearDataLists()

>   Dim x As Integer

>   For x = 0 To MAX_DATA_LISTS
>     DataList(x).isEmpty = 1
>     DataList(x).UserID = ""
>     DataList(x).ArmyID = ""
>     DataList(x).FileNm = ""
>   Next x

> End Sub

> Public Function FindSlot(toFind As Integer) As Integer

>   Dim x As Integer

>   For x = 0 To MAX_ENTRIES
>     If toFind = Army(x).isEmpty Then
>       FindSlot = x
>       Exit Function
>     End If
>   Next x

> End Function



Thu, 11 Nov 2004 23:46:21 GMT  
 Am I going insane...?

Quote:

>The same holds true for any variable .. ie dim a var called index (low case)
>and references to Index in control events also change case. Remember, in
>previous versions of Basic x and X were two different variables,

Eh? Which previous versions ?


Fri, 12 Nov 2004 00:04:42 GMT  
 Am I going insane...?
GW Basic.

--

Randy Birch
MVP Visual Basic
http://www.mvps.org/vbnet/
Please respond only to the newsgroups so all can benefit.


Quote:

> >The same holds true for any variable .. ie dim a var called index (low
case)
> >and references to Index in control events also change case. Remember, in
> >previous versions of Basic x and X were two different variables,

> Eh? Which previous versions ?



Thu, 11 Nov 2004 23:58:47 GMT  
 Am I going insane...?
So let me get this straight. Even if the two declarations cannot "see"
one another (locally declared) they affect one another?

The reason I think I am going insane is because this never used to
happen until I reinstalled VB on my new machine.

I also realized a capitalized variabled won't change anything, but if
I want it to stay lower case it better damn well stay lower case. :)

Quote:
>Peter

>I read your earlier posts, seemed strange, but in the example you posted,
>capitalizing the x in any declare statemement anywhere in your project would
>capitalze every x anywhere in your project. I would even guess it would
>capitalize even the x's in other projects if you loaded them together in the
>ide. Seems to be designed that way.

>Note that vb doesn't care much about capitalisation anyway.

>Cees Harlaar



>> I posted about week or so ago about how variables would auto un-cap
>> themselves for no apparent reason. Well to make sure I wasn't going
>> insane I JUST loaded a single module from my larger app. I made 100%
>> sure the variable WAS NOT globally declared.

>> Now, take these code for example... in VB 6.0 sp5 if I capitalize the
>> first X in "Dim x As Integer" in ClearDataLists I notice the X in the
>> For/Loop, in FindSlot, also becomes capitalizied!!!!

>> I am baffled!!!!

>> Thanks.

>'---------------------------------------------------------------------------
>---------

>> Private Sub ClearDataLists()

>>   Dim x As Integer

>>   For x = 0 To MAX_DATA_LISTS
>>     DataList(x).isEmpty = 1
>>     DataList(x).UserID = ""
>>     DataList(x).ArmyID = ""
>>     DataList(x).FileNm = ""
>>   Next x

>> End Sub

>> Public Function FindSlot(toFind As Integer) As Integer

>>   Dim x As Integer

>>   For x = 0 To MAX_ENTRIES
>>     If toFind = Army(x).isEmpty Then
>>       FindSlot = x
>>       Exit Function
>>     End If
>>   Next x

>> End Function



Fri, 12 Nov 2004 03:53:39 GMT  
 Am I going insane...?
The _compiler_ makes the change. The compiler can "see" both / all of them.
VB is case insensitive in regard to variable names, anyway, and the compiler
is just "trying to do you the favor of keeping your variable names as you
want them".


Quote:
> So let me get this straight. Even if the two declarations cannot "see"
> one another (locally declared) they affect one another?

> The reason I think I am going insane is because this never used to
> happen until I reinstalled VB on my new machine.

> I also realized a capitalized variabled won't change anything, but if
> I want it to stay lower case it better damn well stay lower case. :)

> >Peter

> >I read your earlier posts, seemed strange, but in the example you posted,
> >capitalizing the x in any declare statemement anywhere in your project
would
> >capitalze every x anywhere in your project. I would even guess it would
> >capitalize even the x's in other projects if you loaded them together in
the
> >ide. Seems to be designed that way.

> >Note that vb doesn't care much about capitalisation anyway.

> >Cees Harlaar



> >> I posted about week or so ago about how variables would auto un-cap
> >> themselves for no apparent reason. Well to make sure I wasn't going
> >> insane I JUST loaded a single module from my larger app. I made 100%
> >> sure the variable WAS NOT globally declared.

> >> Now, take these code for example... in VB 6.0 sp5 if I capitalize the
> >> first X in "Dim x As Integer" in ClearDataLists I notice the X in the
> >> For/Loop, in FindSlot, also becomes capitalizied!!!!

> >> I am baffled!!!!

> >> Thanks.

>'--------------------------------------------------------------------------
-
> >---------

> >> Private Sub ClearDataLists()

> >>   Dim x As Integer

> >>   For x = 0 To MAX_DATA_LISTS
> >>     DataList(x).isEmpty = 1
> >>     DataList(x).UserID = ""
> >>     DataList(x).ArmyID = ""
> >>     DataList(x).FileNm = ""
> >>   Next x

> >> End Sub

> >> Public Function FindSlot(toFind As Integer) As Integer

> >>   Dim x As Integer

> >>   For x = 0 To MAX_ENTRIES
> >>     If toFind = Army(x).isEmpty Then
> >>       FindSlot = x
> >>       Exit Function
> >>     End If
> >>   Next x

> >> End Function



Fri, 12 Nov 2004 05:18:10 GMT  
 Am I going insane...?
This I understand. But if I capitalize the declaration (i.e. MyVar)
changing the case of that variable while in use should NOT change the
case of the declared state. If this is normal then for 4 years VB has
not done this... until now.

Thanks.

Quote:
>The _compiler_ makes the change. The compiler can "see" both / all of them.
>VB is case insensitive in regard to variable names, anyway, and the compiler
>is just "trying to do you the favor of keeping your variable names as you
>want them".



>> So let me get this straight. Even if the two declarations cannot "see"
>> one another (locally declared) they affect one another?

>> The reason I think I am going insane is because this never used to
>> happen until I reinstalled VB on my new machine.

>> I also realized a capitalized variabled won't change anything, but if
>> I want it to stay lower case it better damn well stay lower case. :)

>> >Peter

>> >I read your earlier posts, seemed strange, but in the example you posted,
>> >capitalizing the x in any declare statemement anywhere in your project
>would
>> >capitalze every x anywhere in your project. I would even guess it would
>> >capitalize even the x's in other projects if you loaded them together in
>the
>> >ide. Seems to be designed that way.

>> >Note that vb doesn't care much about capitalisation anyway.

>> >Cees Harlaar



>> >> I posted about week or so ago about how variables would auto un-cap
>> >> themselves for no apparent reason. Well to make sure I wasn't going
>> >> insane I JUST loaded a single module from my larger app. I made 100%
>> >> sure the variable WAS NOT globally declared.

>> >> Now, take these code for example... in VB 6.0 sp5 if I capitalize the
>> >> first X in "Dim x As Integer" in ClearDataLists I notice the X in the
>> >> For/Loop, in FindSlot, also becomes capitalizied!!!!

>> >> I am baffled!!!!

>> >> Thanks.

>>'--------------------------------------------------------------------------
>-
>> >---------

>> >> Private Sub ClearDataLists()

>> >>   Dim x As Integer

>> >>   For x = 0 To MAX_DATA_LISTS
>> >>     DataList(x).isEmpty = 1
>> >>     DataList(x).UserID = ""
>> >>     DataList(x).ArmyID = ""
>> >>     DataList(x).FileNm = ""
>> >>   Next x

>> >> End Sub

>> >> Public Function FindSlot(toFind As Integer) As Integer

>> >>   Dim x As Integer

>> >>   For x = 0 To MAX_ENTRIES
>> >>     If toFind = Army(x).isEmpty Then
>> >>       FindSlot = x
>> >>       Exit Function
>> >>     End If
>> >>   Next x

>> >> End Function



Fri, 12 Nov 2004 07:51:14 GMT  
 Am I going insane...?
No, if you ..

Dim MyVar

...and type in code ...

  myVAR = x

...MyVar will not change (well, technically it will ... it will change to
the declared format MyVar). But, if in *another* procedure you ...

Dim myvar

then all MyVar's will become myvar throughout the project. Its been like
this forever that I recall.

And, BTW, if you're using an enum, the enum variable will take whatever is
typed, so if you had:

private enum xxx
    abcVariableA = 1
    abcVariableB
end enum

... and later typed the abcVariableA member in a procedure in all lower
case, the Enum itself would change to:

private enum xxx
    abcvariablea = 1
    abcVariableB
end enum

Now *that's* a pain in the ass.

--

Randy Birch
MVP Visual Basic
http://www.mvps.org/vbnet/
Please respond only to the newsgroups so all can benefit.


Quote:
> This I understand. But if I capitalize the declaration (i.e. MyVar)
> changing the case of that variable while in use should NOT change the
> case of the declared state. If this is normal then for 4 years VB has
> not done this... until now.

> Thanks.

> >The _compiler_ makes the change. The compiler can "see" both / all of
them.
> >VB is case insensitive in regard to variable names, anyway, and the
compiler
> >is just "trying to do you the favor of keeping your variable names as you
> >want them".



> >> So let me get this straight. Even if the two declarations cannot "see"
> >> one another (locally declared) they affect one another?

> >> The reason I think I am going insane is because this never used to
> >> happen until I reinstalled VB on my new machine.

> >> I also realized a capitalized variabled won't change anything, but if
> >> I want it to stay lower case it better damn well stay lower case. :)

> >> >Peter

> >> >I read your earlier posts, seemed strange, but in the example you
posted,
> >> >capitalizing the x in any declare statemement anywhere in your project
> >would
> >> >capitalze every x anywhere in your project. I would even guess it
would
> >> >capitalize even the x's in other projects if you loaded them together
in
> >the
> >> >ide. Seems to be designed that way.

> >> >Note that vb doesn't care much about capitalisation anyway.

> >> >Cees Harlaar



> >> >> I posted about week or so ago about how variables would auto un-cap
> >> >> themselves for no apparent reason. Well to make sure I wasn't going
> >> >> insane I JUST loaded a single module from my larger app. I made 100%
> >> >> sure the variable WAS NOT globally declared.

> >> >> Now, take these code for example... in VB 6.0 sp5 if I capitalize
the
> >> >> first X in "Dim x As Integer" in ClearDataLists I notice the X in
the
> >> >> For/Loop, in FindSlot, also becomes capitalizied!!!!

> >> >> I am baffled!!!!

> >> >> Thanks.

>>'-------------------------------------------------------------------------
-
> >-
> >> >---------

> >> >> Private Sub ClearDataLists()

> >> >>   Dim x As Integer

> >> >>   For x = 0 To MAX_DATA_LISTS
> >> >>     DataList(x).isEmpty = 1
> >> >>     DataList(x).UserID = ""
> >> >>     DataList(x).ArmyID = ""
> >> >>     DataList(x).FileNm = ""
> >> >>   Next x

> >> >> End Sub

> >> >> Public Function FindSlot(toFind As Integer) As Integer

> >> >>   Dim x As Integer

> >> >>   For x = 0 To MAX_ENTRIES
> >> >>     If toFind = Army(x).isEmpty Then
> >> >>       FindSlot = x
> >> >>       Exit Function
> >> >>     End If
> >> >>   Next x

> >> >> End Function



Fri, 12 Nov 2004 09:25:20 GMT  
 Am I going insane...?
Ok. Everywhere (in every single module, etc.) the variable "x" is
declared in lowercase. Every use of this variable is in lowercase, yet
when I save and then reload my project the damn variable is
uppercase!!!

Ahhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh!!!!

Quote:
>No, if you ..

>Dim MyVar

>...and type in code ...

>  myVAR = x

>...MyVar will not change (well, technically it will ... it will change to
>the declared format MyVar). But, if in *another* procedure you ...

>Dim myvar

>then all MyVar's will become myvar throughout the project. Its been like
>this forever that I recall.

>And, BTW, if you're using an enum, the enum variable will take whatever is
>typed, so if you had:

>private enum xxx
>    abcVariableA = 1
>    abcVariableB
>end enum

>... and later typed the abcVariableA member in a procedure in all lower
>case, the Enum itself would change to:

>private enum xxx
>    abcvariablea = 1
>    abcVariableB
>end enum

>Now *that's* a pain in the ass.



Fri, 12 Nov 2004 11:03:36 GMT  
 Am I going insane...?
Whoa nelly... I noticed in certain procedures VB used the variables X
and Y (i.e. MouseDown). Does VB, by default, uppercase these
variables? If so, based on what you all are saying, this can in theory
case all other uses of the variable "x" to be capitalized even if
redeclared?

I am very close to taking VB outside and beating the living daylights
out of it. :)

Quote:
>Ok. Everywhere (in every single module, etc.) the variable "x" is
>declared in lowercase. Every use of this variable is in lowercase, yet
>when I save and then reload my project the damn variable is
>uppercase!!!

>Ahhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh!!!!

>>No, if you ..

>>Dim MyVar

>>...and type in code ...

>>  myVAR = x

>>...MyVar will not change (well, technically it will ... it will change to
>>the declared format MyVar). But, if in *another* procedure you ...

>>Dim myvar

>>then all MyVar's will become myvar throughout the project. Its been like
>>this forever that I recall.

>>And, BTW, if you're using an enum, the enum variable will take whatever is
>>typed, so if you had:

>>private enum xxx
>>    abcVariableA = 1
>>    abcVariableB
>>end enum

>>... and later typed the abcVariableA member in a procedure in all lower
>>case, the Enum itself would change to:

>>private enum xxx
>>    abcvariablea = 1
>>    abcVariableB
>>end enum

>>Now *that's* a pain in the ass.



Fri, 12 Nov 2004 11:10:51 GMT  
 Am I going insane...?

Quote:

>GW Basic.

AKA BASICA - are you sure about that ?
I have no recollection of that at all.
Quote:
>--

>Randy Birch
>MVP Visual Basic
>http://www.mvps.org/vbnet/
>Please respond only to the newsgroups so all can benefit.




>> >The same holds true for any variable .. ie dim a var called index (low
>case)
>> >and references to Index in control events also change case. Remember, in
>> >previous versions of Basic x and X were two different variables,

>> Eh? Which previous versions ?



Fri, 12 Nov 2004 13:57:48 GMT  
 Am I going insane...?
I recall, I think.  It's been along time, but yeah, I think I remember that
x and X were different.  I will have to open that archived compiler and
see... (yes I still have a copy of GW-Basic, call me a packrat.)


Quote:

> >GW Basic.

> AKA BASICA - are you sure about that ?
> I have no recollection of that at all.
> >--

> >Randy Birch
> >MVP Visual Basic
> >http://www.mvps.org/vbnet/
> >Please respond only to the newsgroups so all can benefit.




> >> >The same holds true for any variable .. ie dim a var called index (low
> >case)
> >> >and references to Index in control events also change case. Remember,
in
> >> >previous versions of Basic x and X were two different variables,

> >> Eh? Which previous versions ?



Fri, 12 Nov 2004 16:33:25 GMT  
 Am I going insane...?
NOPE!  Sorry guys, just looked.  GW-Basic 3.22, copywrite 1987 -
10 x=5
20 X=15
30 print x
40 print X

yeilds -

15
15

so X is x

Matt


Quote:
> I recall, I think.  It's been along time, but yeah, I think I remember
that
> x and X were different.  I will have to open that archived compiler and
> see... (yes I still have a copy of GW-Basic, call me a packrat.)




> > >GW Basic.

> > AKA BASICA - are you sure about that ?
> > I have no recollection of that at all.
> > >--

> > >Randy Birch
> > >MVP Visual Basic
> > >http://www.mvps.org/vbnet/
> > >Please respond only to the newsgroups so all can benefit.




> > >> >The same holds true for any variable .. ie dim a var called index
(low
> > >case)
> > >> >and references to Index in control events also change case.
Remember,
> in
> > >> >previous versions of Basic x and X were two different variables,

> > >> Eh? Which previous versions ?



Fri, 12 Nov 2004 16:45:58 GMT  
 
 [ 25 post ]  Go to page: [1] [2]

 Relevant Pages 

1. am i insane?

2. Going insane: ApplyFilter method is NOT working, help

3. Can someone please help im going insane

4. Help needed: going insane with DISK OR NETWORK ERROR

5. HELP PCL CODES ...going insane

6. ** HELP WITH vb 4.0 I am going crazy**

7. Am I going mad?

8. help i am going mad

9. Overflow - Am I going crazy?

10. Where am I going wrong ??!!

11. I think I am going mental

12. Where am i going wrong??? ActiveX Control

 

 
Powered by phpBB® Forum Software