group enumerators so intellisense shows them in VB6?

G

Guest

Hi, If I do this in module myConstants.bas:

Global const One = 1
Global const Two = 2
Global const three = 3

Then in my code, all I have to do is:

if ThisConstant = myConstants. and when I type the dot, Intellisense
shows all of the constants. But if I don't want hundreds of constants
to have to search through, I have groups of constants and try to use
enums. But I can't figure out how to get Intellisense. So If I do:

Public Enum Numbers
One = 1
Two = 2
Three = 3
end enum

I can't do myConstants follows by the dot I don't see anything. I have
to know in advance I want an enum called "Numbers". I want it to work
like .NET where I can do:

myConstants.Numbers.Three Or something similar that lets me have
Intellisense to be able to know what my constants are. It doesn't do
any good to have a module full of enumerations and then have to open
the file to see which one you want. Thanks.

-F
 
C

Chris Dunaway

enums. But I can't figure out how to get Intellisense. So If I do:

Public Enum Numbers
One = 1
Two = 2
Three = 3
end enum

I can't do myConstants follows by the dot I don't see anything.

You should see "Numbers" in the intellisense list plus any additional
enums you have defined. Are you not seeing this?
 
H

Herfried K. Wagner [MVP]

But if I don't want hundreds of constants
to have to search through, I have groups of constants and try to use
enums. But I can't figure out how to get Intellisense. So If I do:

Public Enum Numbers
One = 1
Two = 2
Three = 3
end enum

I can't do myConstants follows by the dot I don't see anything. I have
to know in advance I want an enum called "Numbers". I want it to work
like .NET where I can do:

Use 'Numbers.<IntelliSense opens and you can select the constant>'.
 
G

Guest

Hello, sorry I was not more clear. If I have several enums, I want to
know what their group is, not just intellisense for what the actual
enums under the group are. I need it to be like the .NET languages or
Borland languages. In other words:

Module1

Public enum Names
name = fred
name = john
end enum

Public enum Numbers
One = 1
Two = 2
end enum

What I would like is to be able to type something like
"Module1.Names.Fred". And I need intellisense at every dot. Instead,
I can't use Module1 followed by a dot. Nothing happens unless I use
"Global Const Fred", etc. If I do that, I can type Module1. and get a
list of every global constant, but they are not grouped logically. If
I use the enums, I can not see a way to type "Module1" followed by a
dot to see what my enums are. I must know in advance what my enums are
called. Without Intellisense, how do I know that there are enums
called "names" and "numbers"? That is what I need to find out. Then
once I find each enum, I need Intellisense to tell me what enums are
there. If I know I am looking for an enum called "Names", I can type
"Names. " and get a list of names. But I need a list of enums first.
Thanks.

Fred
 
H

Herfried K. Wagner [MVP]

If I have several enums, I want to
know what their group is, not just intellisense for what the actual
enums under the group are. I need it to be like the .NET languages or
Borland languages. In other words:

Module1

Public enum Names
name = fred
name = john
end enum

Public enum Numbers
One = 1
Two = 2
end enum

What I would like is to be able to type something like
"Module1.Names.Fred". And I need intellisense at every dot.

I don't think that grouping enumerations in a module is a good idea.
Instead you may want to use a namespace declaration:

\\\
Namespace Foo
Public Enum Goo
...
End Enum

Public Enum Bar
...
End Enum
End Namespace
///
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top