|
-
May 5th, 2008, 02:22 PM
#1
[RESOLVED] Side question about UDTs
I defined a UDT in these terms,
Type Curve
n As Integer
x() As Single
y() As Single
End Type
Then after I close the IDE and go back to the project at a later time I find the single variables have been converted to upper case
X() As Single
Y() As Single
Not that it matters much but I like them lower case and I just have no idea why this happens.
Lottery is a tax on people who are bad at maths
If only mosquitoes sucked fat instead of blood...
To do is to be (Descartes). To be is to do (Sartre). To be do be do (Sinatra)
-
May 5th, 2008, 03:14 PM
#2
Re: Side question about UDTs
VB6 saves variable names globally...
For example, make 2 functions/subs, both of them with the same variable name (with same type or diferent type, it does not matter), then change the Cation on one of the variables, and see what happens with the other in the ohter function...
For example
Code:
Private Sub Func1()
Dim TestVariable As String
End Sub
Private Sub Func2()
Dim TestVariable As Integer
End Sub
Just change "TestVariable" to "Testvariable", and see what happens
This hapened to me a lot, and it is quite anoying, especially when you include a module/class (that is not made by me) using same variable names as I do. It took me a long time to figure out why I cannot change the variable name, and it always jumps to some other caption state...
-
May 6th, 2008, 04:41 AM
#3
Re: Side question about UDTs
 Originally Posted by CVMichael
VB6 saves variable names globally...
For example, make 2 functions/subs, both of them with the same variable name (with same type or diferent type, it does not matter), then change the Cation on one of the variables, and see what happens with the other in the ohter function...
For example
Code:
Private Sub Func1()
Dim TestVariable As String
End Sub
Private Sub Func2()
Dim TestVariable As Integer
End Sub
Just change "Test Variable" to "Test variable", and see what happens
This hapened to me a lot, and it is quite anoying, especially when you include a module/class (that is not made by me) using same variable names as I do. It took me a long time to figure out why I cannot change the variable name, and it always jumps to some other caption state...
Well, thanks for clarifying the issue. I smelled something like this but wasn't sure exactly what it was. I'll have to be more imaginative with my variable names, still x,y for coordinates are very intuitive.
Lottery is a tax on people who are bad at maths
If only mosquitoes sucked fat instead of blood...
To do is to be (Descartes). To be is to do (Sartre). To be do be do (Sinatra)
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
|