error count days between dates

Discussion in 'Questions (Windows Mobile)' started by mike2ppc, Oct 23, 2008.

  1. mike2ppc

    mike2ppc Member Licensed User

    Hello together,

    I'm trying to calc the total of days between two dates.
    When I'm running the source in the dev IDE all works fine,
    but after compiling and executing the comp version I got
    a error message '...Input String was not in correct format ...'
    Please see attache source and compile it and execute the
    exe file.

    click button 'Count ....'

    Best Regards

    Last edited: Oct 23, 2008
  2. Erel

    Erel Administrator Staff Member Licensed User

    The problem is with this line:
    textBox3.text = textBox3.Text + 1
    Unlike regular variables, you need to first assign 0 to the textbox.

    However your code will still not work correctly.
    Dates are stored as ticks which are very big numbers and small rounding errors may occur during calculations. The result is that start_date may not be exactly equal to end_date and the loop will not stop.

    The simple solution from the tutorial is
    [COLOR=#010101]d1 = [COLOR=#0000ff]DateParse[/COLOR]([COLOR=#800000]"04/30/2006"[/COLOR])
    d2 = [COLOR=
  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