use switch case to compare label1.text.length

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • sentimental37
    New Member
    • May 2010
    • 23

    #1

    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
    Code:
     if (label1.Text.Length <= 87)
                {
                 //do something
                }
                else if(label1.Text.Length <=174)
                {
                   //do something
                }
                else if (label1.Text.Length <=261)
                {
                   //do something
                }
                else if (label1.Text.Length <=348)
                {
                   //do something
                }
    if it is possible to use it in a switch case then how plzzzzzz reply thanksss
  • GaryTexmo
    Recognized Expert Top Contributor
    • Jul 2009
    • 1501

    #2
    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.

    Comment

    Working...