select-case

Select Case on an object's Type in VB.Net

I'm not sure if this valid C# but hopefully you get the idea. :) switch (msg.GetType()) { case ClassA: // blah case ClassB: // blah 2 case ClassC: // blah 3 } How would I switch on an object's type but using VB.NET's Select Case? I'm aware that some might suggest using polymorphism but I'm using a ...

Pass in Array to Select Case

Hi, this may be a dense question and I'm not finding it to be a dup of this one, but I need some help with understanding if an array can be used in a Select Case statement. I have a sub routine that I will create a string array dynamically. The XML is also listed, but it could be any of the values listed below. It will be something like...

Why should i use exit select?

Here are a couple of questions i gathered regarding exit select... Is there any reason for using exit select in VB.NET? The reason has anything to do with performance? The exit select is equal to break;? Example 1 Select case Name case "Mary" '... case "John" '... case else end select Example 2 Select case Name case "Mary" '......

Converting DayOfWeek enum to a string repesenting the day

I was wondering if there was a way to directly convert the integer DayOfWeek returns into a string representing the day like Monday, Tuesday etc. Sample code: MessageBox.Show(Date.Today.DayOfWeek) This will return 6 (as of today). Is there a way to directly convert this into Saturday, for example? I don't really care what it really c...

Can you use .Contains(string) with a Select Case Statement?

Is there anyway I can build a Select statement that uses the Contains function? Like this: Select commentStr Case commentStr.Contains("10") Case commentStr.Contains("15") ...

Comparing the Oracle Interval Data Type

I have an oracle time interval in a select statement like this: SELECT ... CASE WHEN date1 - date2 > 0 THEN 'No' ELSE 'YES' END This fails with an invalid data type. So I tried this, and it still fails. SELECT ... CASE WHEN date1 - date2 > (sysdate - sysdate) THEN 'No' ELSE 'YES' END Is there any way t...

How to best convert VB6 "Select Case 1067 To 2938..." to C#?

I'm converting some VB6 logic to C# and have encountered the following SELECT/CASE statement. Select Case ZipCode Case 1067 To 19417, 35075 To 35085, 48455 To 48465, 55583 To 55596, 67480 To 67551, 75392, 85126, _ 93047 To 93059, 21217 To 21739, 35091 To 35096, 48480, 55606 To 55779, 67655 To 67707, 76726 To 76835, _ 85221 To 87...

VB.net Select Case Statement with Beginswith

Is there a way to use the Select Case statment in VB.net for beginswith? Or do i have to use a long elseif? Example: If text.StartsWith("/go") then elseif test.StartsWith("/stop") elseif test.StartsWith("/continue") End If But instead something like: Select Case text Case text.StartsWith("/go") Case text.StartsWith("/stop") Case text...