Thread: Visual Basic
View Single Post
  #11   Spotlight this post!  
Unread 13-11-2007, 23:07
EHaskins EHaskins is offline
Needs to change his user title.
AKA: Eric Haskins
no team (CARD #6 (SCOE))
Team Role: College Student
 
Join Date: Jan 2006
Rookie Year: 2006
Location: Elkhorn, WI USA
Posts: 998
EHaskins has a reputation beyond reputeEHaskins has a reputation beyond reputeEHaskins has a reputation beyond reputeEHaskins has a reputation beyond reputeEHaskins has a reputation beyond reputeEHaskins has a reputation beyond reputeEHaskins has a reputation beyond reputeEHaskins has a reputation beyond reputeEHaskins has a reputation beyond reputeEHaskins has a reputation beyond reputeEHaskins has a reputation beyond repute
Send a message via MSN to EHaskins
Re: Visual Basic

Quote:
Originally Posted by jee7s View Post
Yes, that's a switch-case statement. However, a fall-through switch case statement is a little different:

I might be wrong about that VB switch statement, but I'm pretty sure it doesn't support the fall-through idea.

de KG2OV
Thanks for the clarification. I should have know that, but I don't remember ever seeing that in practice.

However, after reading your post i decided to try that in C#, and as far as I can tell C# dosn't support that either.

This code:
Code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Diagnostics;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            int i = 10;
            switch (i) {
                case (1):
                    Debug.Print("1");
                case (2):
                    Debug.Print("2");
            }
        }
    }
}
generates these errors:
Error 1 Control cannot fall through from one case label ('case 1:') to another C:\Users\Eric Haskins\Documents\Visual Studio 2008\Projects\ConsoleApplication1\ConsoleApplicati on1\Program.cs 15 17 ConsoleApplication1
Error 2 Control cannot fall through from one case label ('case 2:') to another C:\Users\Eric Haskins\Documents\Visual Studio 2008\Projects\ConsoleApplication1\ConsoleApplicati on1\Program.cs 17 17 ConsoleApplication1

Am I being stupid again, or is this a limitation of all .net languages?

EDIT: I found my own answer. http://msdn2.microsoft.com/en-us/lib...28(VS.90).aspx That seems slightly old VBish.
EDIT: More info http://blogs.msdn.com/abhinaba/archi...15/492866.aspx
-Eric
__________________
Eric Haskins KC9JVH

Last edited by EHaskins : 13-11-2007 at 23:18.