A good bit of lateral thinking.
"Jay B. Harlow [MVP - Outlook]" <Jay_Harlow_MVP@msn.com> wrote in message
news:%23y4QP$o4DHA.3224@tk2msftngp13.phx.gbl...
> Charles,
>
> > So I get the advantage of intellisense. When I type
>
> What I normally do in that case is define const members of a class
>
> > Public NotInheritable Class Special
> > Const Abra As Integer = &H1
> > Const Cadabra As Integer = &H2
>
> Private Sub New()
> End Sub
>
> > End Class
>
> > MyVal = Special.
>
> Of course I need to type the name of the class, however I then get the
names
> of the constants...
>
> Note the Notinheritable prevents others from inheriting the Special class,
> while Private Sub New prevents others form instantiating the Special
class,
> as Special is intended only to offer constants.
>
> Hope this helps
> Jay
>
> "Charles Law" <blank@nowhere.com> wrote in message
> news:epbIo9l4DHA.1936@TK2MSFTNGP12.phx.gbl...
> > Hi Armin
> >
> > So I get the advantage of intellisense. When I type
> >
> > MyVal =
> >
> > I want the convenience of a list popping up to choose from.
> >
> > It is rare that I need the underlying value, as people have indicated,
it
> is
> > not common to use them in this way. However, I have the case where a
> > parameter in a structure can take values from a set list, e.g.
> >
> > Public Enum Special
> > Abra = &H1
> > Cadabra = &H2
> > End Enum
> >
> > Public Structure MyStruct
> > Dim Param1 as Integer
> > Dim Param2 as Special
> > End Structure
> >
> > Then, I may want to do this
> >
> > Dim MyStructInstance As MyStruct
> >
> > MyStructInstance.Param2 = Abra Or Cadabra
> >
> > Should Param2 now contain 3? It probably will in this case. But what
about
> >
> > MyStructInstance.Param2 = Abra
> >
> > Now, perhaps Param2 contains Abra. I haven't tried this, but this is the
> > type of thing I wish to do.
> >
> > Am I going about this the wrong way? The values will not always be
binary
> as
> > above, but sometimes. How would you do it?
> >
> > Charles
> >
> >
> > "Armin Zingler" <az.nospam@freenet.de> wrote in message
> > news:eSTXN$k4DHA.384@TK2MSFTNGP11.phx.gbl...
> > > "Charles Law" <blank@nowhere.com> schrieb
> > > > Hi Herfried
> > > >
> > > > Ah, but why does the following do the same?
> > > >
> > > > <code>
> > > > Dim str As String
> > > >
> > > > str = String.Format("t={0}", t)
> > > > </code>
> > > >
> > > > str now contains "t=Cadabra". It is very painful, not to say error
> > > > prone if I have to remember to write
> > > >
> > > > <code>
> > > > Dim str As String
> > > >
> > > > str = String.Format("t={0}", CInt(t))
> > > > </code>
> > > >
> > > > Or is that what you would expect?
> > >
> > > Also what I would expect.
> > >
> > > Why do you use an enum if you are interested in the numeric values?
(see
> > > also my other post)
> > >
> > >
> > > --
> > > Armin
> > >
> > >
http://www.plig.net/nnq/nquote.html > > >
http://www.netmeister.org/news/learn2quote.html > > >
> >
> >
>
>