need simple code code tht uses issue date and return date to calculate fine but doesnt use datetimepicker tool..

Recommended Answers

All 2 Replies

See if this is "simple" enough.

Dim dateBookIssued As Date = "5/24/2005" '// Month, Day, Year.
        Dim dateBookReturned As Date = "10/20/2010" '// Month, Day, Year.
        '// Subtract the Date book was Issued from Date book was Returned.
        Dim overdueTime As TimeSpan = dateBookReturned.Subtract(dateBookIssued)
        '// convert Total Days String to Integer and multiply by .15 cents for each day.
        Dim totalFeeCost As Decimal = CInt(overdueTime.Days.ToString) * 0.15
        '// display formatted Total Fee Cost.
        MsgBox(Format(totalFeeCost, "$#.00"))
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
    Dim sdate As DateTime
    Dim edate As DateTime
    Dim ts As TimeSpan
    Dim days As Integer
    Dim days1 As Integer

    sdate = Convert.ToDateTime(Me.Txt_idt.Text)
    edate = Convert.ToDateTime(Me.Txt_ddt.Text)
    ts = edate - sdate
    days = ts.Days
    Me.Txt_tdys.Text = (days)
    days1 = (days - 15)
    If days1 > 0 Then
        Me.Txt_fdys.Text = days1
        Me.Txt_rs.Text = (days1 * 2)
        Me.Lbl_msg.Text = "SORRY YOUR HAVE FINE"

    End If

End Sub
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.