Returning subroutine error - Input string was not in the correct format

Discussion in 'Questions (Windows Mobile)' started by HarleyM, Oct 19, 2007.

  1. HarleyM

    HarleyM Member Licensed User

    Hi all,
    It's been a while since I have been using basic4ppc & visited this forum. In the meantime I can see so much has happened..

    Anyway, I have attempted to upgrade a program I was writing in version 4 to version 5. After debugging the initial program errors associated with the new compiller I was able to run the program. Unfortunately I encounter an error during the run which I have never seen before. "Input string was not in the correct format" appears after returning from a subroutine. I have single stepped my way through the subroutine which opens a form which itself opens a subroutine & then another. As I step through the code it returns back along the path closing respective subs until it comes back to the original subroutine call instruction- thats when I get this error. The error allows me to continue & everything seems to function correctly until it comes up again & again as more subs are called. I suspect a stack return problem but can't understand why it would work fine in version 4 & not in 5.

    I apologize if this has been covered elsewhere, I searched for it but haven't found what I'm looking for. Any ideas?
     
  2. Erel

    Erel Administrator Staff Member Licensed User

    Can you post the part of your code that makes this problem?
     
  3. HarleyM

    HarleyM Member Licensed User

    What I think are the relevant parts of my program ...

    Sub App_Start
    ...
    If FileExist(Filepath & "Autolog.atl") = false then
    fileopen(c1,Filepath & "Autolog.atl",cWrite)
    Fileclose (c1)
    NewVehicle ()
    vehicle.Show
    else
    fileopen(c1,Filepath & "Autolog.atl",cRead)
    s = fileread(c1)
    if s <> eof then
    for x=1 to 7
    i = StrIndexOf (s,",",0)
    if i < 0 then
    Col(x) = SubString(s,0,StrIndexOf(s," ",0))
    x=7
    else
    Col(x) = SubString(s,0,i)
    s= SubString(s,i+1,StrLength(s))
    end if
    next x
    ...
    FileClose(c1)
    LoadData () ' <<<<<<------------------------error occurs here when it returns after doing the LoadData sub
    else
    FileClose (c1)
    NewVehicle ()
    Vehicle.Show
    end if
    end if
    ....
    End sub

    Sub LoadData
    ...
    fileopen(c1,OdometerRecs,cRead)
    s = fileread(c1)
    do while s <> EOF
    ....
    loop
    fileclose(c1)
    DataRecords.Show
    ...
    End Sub

    Sub DataRecords_Show
    .....
    Set4OdoTab(10)
    End Sub

    Sub Set4OdoTab(TabRef)
    .... 'sets up tabbing conditions for controls in datarecords form
    End Sub
     
    Last edited: Oct 19, 2007
  4. HarleyM

    HarleyM Member Licensed User

    I do believe that the sub calling syntax has changed...

    could it be that a should be calling my subs without brackets if i'm not passing data...:sign0161:
     
  5. Erel

    Erel Administrator Staff Member Licensed User

    Yes. You should just write the name of the sub.
     
Loading...