473,385 Members | 1,642 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,385 software developers and data experts.

use switch case to compare label1.text.length

hi i m using the following code in if-else can i use the same in switch case
Expand|Select|Wrap|Line Numbers
  1.  if (label1.Text.Length <= 87)
  2.             {
  3.              //do something
  4.             }
  5.             else if(label1.Text.Length <=174)
  6.             {
  7.                //do something
  8.             }
  9.             else if (label1.Text.Length <=261)
  10.             {
  11.                //do something
  12.             }
  13.             else if (label1.Text.Length <=348)
  14.             {
  15.                //do something
  16.             }
  17.  
if it is possible to use it in a switch case then how plzzzzzz reply thanksss
Nov 23 '10 #1
1 2079
GaryTexmo
1,501 Expert 1GB
http://msdn.microsoft.com/en-us/libr...8VS.71%29.aspx

Have a read here. A switch statement can only test equality, if an expression is equal to a constant term.
Nov 23 '10 #2

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

Similar topics

13
by: Richard | last post by:
I've been looking at implementing switch/case on my photo gallery. Most of the sites I've seen so far, only show the bare basics. With no real practical examples. As brucie does with his...
21
by: Andy | last post by:
Can someone tell me if the following Switch...Case construct is valid? I'm wanting to check for multiple values in the Case statement without explicitly listing each values. So for example, will...
1
by: Julius Fenata | last post by:
Hi all, How to synchronize Label1.text between: document.getElementById("Label1").innerText (at Client Script) & Label1.text (Code Behind). I mean, I have assign new value to Label1 in Client...
15
by: Benny Raymond | last post by:
I'm confused as to how fallthrough is limited in switch. For example the following works: string switch_test = "a"; switch (switch_test) { case "a": case "b": case "c": doSomething(a);
3
by: Alan Roberts | last post by:
In VB6 I could do the following Select Case Right$(Text, 1) Case "a","b" do this Case "c","d" do this Case else do this End Select
9
by: sam_cit | last post by:
Hi Everyone, I wanted to know as to how a switch case like the following one is converted into a jump table by the compiler, assuming that it does, switch(i) { case 4 : { ... printf("4");
4
by: alingeorge | last post by:
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 switch (op) { case "+" : d3 = d1 + d2; ...
6
by: asit | last post by:
please modify to get the correct output.(switch case is compulsory) #include <stdio.h> int main() { char ch; printf("Enter any character : "); ch=getch(); switch(ch)
13
by: Satya | last post by:
Hi everyone, This is the first time iam posting excuse me if iam making any mistake. My question is iam using a switch case statement in which i have around 100 case statements to compare. so...
2
by: Annalyzer | last post by:
My form looks like this: <form action="handle_event.php" method="POST" enctype="multipart/form-data"> <table id="event_edit" border="0"> <tr> <td> ...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
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: 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...

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.