datediff problem?

hi there i have a problem regarding datediff... when i click the button the msgbox promt me "0"

here's my code:

'two masked textbox mtext1 and mtext2

dim mtext00 as date

dim mtext01 as date

dim m as integer

mtext00 = mtext1

mtext01 = mtext2

m = datediff(interval.days, mtext00, mtext01)

msgbox (m)




Answer this question

datediff problem?

  • Ludovico

    Your code doesn't look like it will compile. I fixed it up here (.Net 2.0):

    Dim mtext00 As Date

    Dim mtext01 As Date

    Dim m As Integer

    mtext00 = CDate(mtext1.Text)

    mtext01 = CDate(mtext2.Text)

    m = DateDiff(DateInterval.Day, mtext00, mtext01)

    MsgBox(m)



  • Annant

    mtext00 = Format(CDate(mtext1), "dd/mm/yyyy")

    mtext01 = Format(CDate(mtext2), "dd/mm/yyyy")

    m = datediff(interval.days, mtext00, mtext01)

    Maybe you can try this out!


  • datediff problem?