PJ6
There is no "Is" operator in a Select Case per se!
Notice that in a Select Case that "Is" is used to introduce a comparison
operator, such as <, >, <=, >=, =, or <>. That is "[Is] comparisonoperator".
IMHO: using "Case Is < 10" reads better then "Case < 10", however that is
largely personal preference.
Its similar to the "Is" keyword in the "TypeOf Is" operator.
--
Hope this helps
Jay B. Harlow [MVP - Outlook]
..NET Application Architect, Enthusiast, & Evangelist
T.S. Bradley -
http://www.tsbradley.net
| OK, but I don't see why they have that restriction, why the "Is" operator
| here cannot function the same as the "Is" operator elsewhere. It would
seem
| to me an arbitrary and rather unnecessary break in convention.
|
| Paul
|
| message | > Paul,
| > | Why doesn't this work?
| > Case requires "elementary data type". Type is not a "elementary", but
| > rather
| > it is a class.
| >
| >
http://msdn2.microsoft.com/en-us/library/cy37t14y.aspx
| >
| >
| > | Can I make it work or am I stuck with ElseIf for a
| > | long list?
| > When checking for specific types, I would use a ElseIf as it ensures
that
| > derived types are handled correctly.
| >
| > You can get a select case to work, by using the type names, however then
| > you
| > are limited to the type names & if you ever change the name of the type
| > your
| > select case will break.
| >
| > Something like:
| > | Select Case o.GetType.ToString
| > | Case "SomeNameSpace.SomeRandomTypeName"
| > | '...
| > | End Select
| >
| >
| > --
| > Hope this helps
| > Jay B. Harlow [MVP - Outlook]
| > .NET Application Architect, Enthusiast, & Evangelist
| > T.S. Bradley -
http://www.tsbradley.net
| >
| >
| > | > | Select Case o.GetType
| > | Case = GetType(SomeRandomTypeName)
| > | '...
| > | End Select
| > |
| > | Why doesn't this work? Can I make it work or am I stuck with ElseIf
for
| > a
| > | long list?
| > |
| > | Paul
| > |
| > |
| >
| >
|
|