|
-
August 10th, 2001, 04:23 PM
#1
annoying name changing
Hi,
i have a problem: i've created a Public Enum in a module and declared some variables of this type, my problem is that whenever i want to set/check the variable for the Enum value name it changes it's letters (in the Enum declaration)
i.e. if i wrote: Public Enum... MyConst=3...
and later i write: if MyVar=myconst, MyConst turns to myconst.
how can i override that?
----------
The @host is everywhere!
----------
-
August 10th, 2001, 05:56 PM
#2
Re: annoying name changing
you can declare it as a PUBLIC CONST seperately instead of declaring it in that Public Enum function.
public Const MyConst = 3
.
.
.
public Enum... MyConst...
.
.
.
If MyVar = MyConst then
.
.
.
[email protected]
-
August 12th, 2001, 01:57 PM
#3
Re: annoying name changing
yes, ofcourse but that is the whole idea of Enum, creating a union of consts...
----------
The @host is everywhere!
----------
-
August 13th, 2001, 08:43 AM
#4
Re: annoying name changing
Tried a little test case and could not duplicate your described error. I am using VB 6.0 Pro edition. Here is the sample I used.
'
' In a module
'
option Explicit
public Enum MyConstants
MyConst = 1
End Enum
'
'
In a form
'
option Explicit
private Sub Text1_Change()
Text1 = MyConst
End Sub
I keyed the Text1 = myconst and VB IDE changed it to MyConst just like it is spelled in the Enum not viceversa as you specified. Look for another usage of the myconst in your program that could be effecting the outcome.
John G
-
August 13th, 2001, 08:58 AM
#5
Re: annoying name changing
No - I get the behaviour described in VB5(SP2)
It may have been fixed in VB6.
I developed a peculiar coding style as a result:
'usual code
Select Case EventVB.WindowMessage
Case WM_MOVE
Case else
End Select
'workaround thingy
Select Case true
Case EventVB.WindowMessage = WM_MOVE
Case else
End Select
That way the IDE always provides you with a dropdown of the enumerated type options so you don't get the chance of changing their case.
HTH,
Duncan
-------------------------------------------------
Ex. Datis: Duncan Jones
Merrion Computing Ltd
http://www.merrioncomputing.com
Check out the new downloads - ImageMap.ocx is the VB control that emulates an HTML image map, EventVB.OCX for adding new events to your VB form and adding System Tray support simply, MCL Hotkey for implemenmting system-wide hotkeys in your application...all with source code included.
-
August 13th, 2001, 02:22 PM
#6
Re: annoying name changing
I tried out my example on VB 5.0 (no service pack ) and it fails for me also.
John G
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
|