473,394 Members | 1,703 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

switch case is not working...

the op is a string value and i'm trying to check it in switch case. But the control doesnt enter into the case statement
Expand|Select|Wrap|Line Numbers
  1. switch (op)
  2.         {
  3.  
  4.             case "+" : d3 = d1 + d2;
  5.                 Label1.Text = d3.ToString();
  6.                 break;
  7.  
  8.             case "-": d3 = d1 - d2;
  9.                 Label1.Text = d3.ToString();
  10.                 break;
  11.  
  12.         }
Plz help me....

Thanks....
Nov 16 '07 #1
4 1364
jhardman
3,406 Expert 2GB
Which language are you using, and which version of ASP?
Nov 19 '07 #2
Which language are you using, and which version of ASP?
i'm using C#.Net and Asp.Net 2.0
Dec 4 '07 #3
JamieHowarth0
533 Expert 512MB
Your thread has been moved to the .NET Forum. The ASP Forum is for classic ASP, predominantly using VBScript.

medicineworker
Dec 4 '07 #4
Plater
7,872 Expert 4TB
I don't believe the op value contains what you think it contains, if you cannot use the debugger, then I would suggest doing this:
Expand|Select|Wrap|Line Numbers
  1. switch (op)
  2.         {
  3.  
  4.             case "+" : d3 = d1 + d2;
  5.                 Label1.Text = d3.ToString();
  6.                 break;
  7.  
  8.             case "-": d3 = d1 - d2;
  9.                 Label1.Text = d3.ToString();
  10.                 break;
  11.             default:
  12.                 Label1.Text = "'"+op+"'";
  13.                 break;
  14.         }
  15.  
To see what you're actually getting.
Dec 4 '07 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

10
by: clueless_google | last post by:
hello. i've been beating my head against a wall over this for too long. setting the variables 'z' or 'y' to differing numbers, the following 'if/else' code snippet works fine; however, the ...
11
by: hasadh | last post by:
Hi, is the assemly code for if..else and switch statements similar. I would like to know if switch also uses value comparison for each case internally or does it jump to the case directly at...
19
by: rdavis7408 | last post by:
Hello, I have four textboxes that the user enters the price per gallon paid at the pump, the mileage per gallon and I would like to then calculate the cost per gallon and use a switch statement to...
9
by: PhreakRox | last post by:
The ToClose switch in this program is not working as expected, it allways returns a null value, if anyone knows a way to fix up the code, or can suggest a better method of doing so, your help would...
7
by: Rohit | last post by:
Hi, I am working on a switch module which after reading voltage through a port pin and caterogizing it into three ranges(open,low or high), passes this range to a function switch_status() with...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.