Help With Code Please

Discussion in 'Questions (Windows Mobile)' started by cdeane, Jan 19, 2009.

  1. cdeane

    cdeane Member

    I got a question.

    I need a code that dose something like this that will work:

    If TextBox1.Text 0 To 14 Then
    Textbox2.Text = 1
    Else If Textbox1.Text 15 To 29 Then
    Textbox2.Text = 2
    Else
    Textbox2.Text = 3
    End If
     
    Last edited: Jan 19, 2009
  2. Cableguy

    Cableguy Expert Licensed User

    1st way:

    If TextBox1.Text >0 and TextBox1.Text< 14 Then
    Textbox2.Text = 1
    Else If Textbox1.Text>15 and TextBox1.Text< 29 Then
    Textbox2.Text = 2
    Else
    Textbox2.Text = 3
    End If

    2nd way:

    Select TextBox1.text

    case >0 and <14
    TextBox2.text=1
    case >15 and <29
    TextBox2.Text=2
    Case >= 30
    TextBox2.text=3
    End select
     
  3. cdeane

    cdeane Member

    Thanks Cableguy
     
  4. Erel

    Erel Administrator Staff Member Licensed User

    This code will not work:
    Code:
    Select TextBox1.text
    case >0 and <14
    TextBox2.text=
    1
    case >15 and <29
    TextBox2.Text=
    2
    Case >= 30
    TextBox2.text=
    3
    End select
    Select Case doesn't support these operators.
     
  5. klaus

    klaus Expert Licensed User

    The code should be:
    Code:
    If TextBox1.Text >= 0 and TextBox1.Text <= 14 Then
      Textbox2.Text = 
    1
    Else If Textbox1.Text >= 15 and TextBox1.Text <= 29 Then
      Textbox2.Text = 
    2
    Else
      Textbox2.Text = 
    3
    End If
    Otherwise you will miss the values 14, 15 and 29

    Best regards.
     
  6. cdeane

    cdeane Member

    Thanks Klaus

    That did the trick.
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice