Does this VB6 code have a way of doing this in C#?
Case "01" To "04" :
Thanks ahead of time.
aar
Case "01" To "04" :
3 Answers
Know the answer? Post it. Somebody with the same question will find it here.
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend4days leftRegister
Roy S194 reputationPosted Jun 8, 2011, 8:52 AM EDT
switch (var)
{
case "01":
case "02":
case "03":
case "04":
DoStuff();
break;
default:
break;
}
Jiteendra SampathiraoRank #585 · 4.1K reputationPosted Jun 8, 2011, 8:55 AM EDT
If you r looking for switch case in c#:
string myInput;
int myInt;
begin:
Console.Write("Please enter a number between 1 and 3: ");
myInput = Console.ReadLine();
myInt = Int32.Parse(myInput);
// switch with integer type
switch (myInt)
{
case 1:
Console.WriteLine("Your number is {0}.", myInt);
break;
case 2:
Console.WriteLine("Your number is {0}.", myInt);
break;
case 3:
Console.WriteLine("Your number is {0}.", myInt);
break;
default:
Console.WriteLine("Your number {0} is not between 1 and 3.", myInt);
break;
VulpesRank #55 · 29.2K reputationPosted Jun 8, 2011, 9:03 AM EDT