473,799 Members | 3,072 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

use switch case to compare label1.text.len gth

23 New Member
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 2094
GaryTexmo
1,501 Recognized Expert Top Contributor
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
2020
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 butterlies and bugs, he uses switch/case, but in php. Visitor clicks on a thumbnail selection and the thumbs appear. Selection of a thumb shows the larger pic AND description. Since the selection is basically making a choice as within a form, how does
21
7657
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 case 1-35: work? If this would work, will it consider all numbers between 1 and 35 inclusive of 1 and 35? Please let me know if the following will work below: switch(state){ case 1-35: case 37:
1
2602
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 Script, i.e.: document.getElementById("Label1").innerText = "ABC"
15
3518
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
36989
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
11007
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
1379
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; Label1.Text = d3.ToString(); break; case "-": d3 = d1 - d2;
6
4540
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
11862
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 just curious to find out is it effective to use this method?? or is there is any other alternative method present so that execution time and code size can be reduced?? Thanks in advance.
2
3175
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> <label for="title">TITLE: </label> </td> <td class="input"> <input id="title" name="title" type="text" size="80" value="<?php if (!empty($title)) {echo $title;} ?>" />
0
9687
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9541
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10484
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10251
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10228
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10027
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7565
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5463
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
3
2938
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.