return issue

Discussion in 'Questions (Windows Mobile)' started by Cableguy, Sep 20, 2007.

  1. Cableguy

    Cableguy Expert Licensed User

    Hi,guys

    I have a sub calling another sub several times in order to give me a random on/off state, like this:

    sub setup
    ....
    image1.image=rnd_img(state)&".png"
    ....
    image2.image=rnd_img(state)&".png"
    ....
    End Sub

    Sub rnd_img
    x=rnd(0,2)
    if x= 0 then state="ON" Else state="OFF"
    retun(state)
    End Sub

    The return keyword errors with a "FormatException" so nothing is passed to the calling sub...
    Why??
     
  2. Erel

    Erel Administrator Staff Member Licensed User

    You should change it to:

    return state
    instead of
    return (state)
     
Loading...