|
-
Jul 10th, 2000, 01:05 PM
#1
Thread Starter
Member
I'm trying to follow a coding example in VB5 and the words
private enum
end enum
are used in the declarations of a module. Isn there a VB4 equivelency?
Old Man
Using VB6 Professional Ediion
-
Jul 10th, 2000, 01:48 PM
#2
unfortunately, VB4 doens't support Enums.
-
Jul 10th, 2000, 05:07 PM
#3
Frenzied Member
You Can Do Pretty Much The Same thing tho, where you get a statement
Code:
Public Enum MyEnum
MyEnum1 = 1
MyEnum2 = 2
MyEnum3 = 3
End Enum
just Change it to
Code:
Public Const MyEnum1 = 1
Public Const MyEnum2 = 2
Public Const MyEnum3 = 3
and whereever it declares a variable As MyEnum declare it as Long instead. You won't get the picklists but all the Code will still work.
-
Jul 11th, 2000, 10:17 AM
#4
Advantage of Enums is that you can use it as a returned value (for example in a function):
Code:
Public Enum enumMyColor
RED = 1
BLUE = 2
GREEN = 3
YELLOW = 4
End Enum
Public Function GetMyColor() As enumMyColor
'Do something here
'Return Color Value (for example red)
GetMyColor = RED
End Function
-
Jul 11th, 2000, 10:38 AM
#5
Frenzied Member
It's an advantage because it makes the Code more readable and Neater sure, but as far as the actual Running of the Final Product Goes there's no diffence between Enums and constants is There?
-
Jul 11th, 2000, 11:07 AM
#6
Nope. It will be just a lot easier to maintain (and read).
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
|