Results 1 to 40 of 82

Thread: ***resovled****I need urgent help with a date calculator

Threaded View

  1. #1

    Thread Starter
    Lively Member Supreme Cookie's Avatar
    Join Date
    Nov 2002
    Location
    A small box
    Posts
    109

    Exclamation ***resovled****I need urgent help with a date calculator


    I'm relativly new to Vb i juststarted like 2 weeks ago. I have a project to complete and i want VB to tell me the number of days that have passed between date given by user and today's date i believe i got most of the coding right but plz help me i need this done for tomarrow....here is my code

    Option Explicit
    Dim d1 As Long
    Dim m1 As Long
    Dim y1 As Long

    Private Sub cmdcompute_Click()
    picfee.Cls
    Dim Name As String
    Dim Book As String
    Dim CheckMonth As String
    Dim CheckDay As String
    Dim CheckYear As String
    Dim m2 As Long
    Dim d2 As Long
    Dim y2 As Long
    Dim Totaldays As Long
    Dim i As Long

    Totaldays = (y2 - y1) * 365
    ' 30 day months: september 9 april 4 june 6 november 11
    ' 28 day months: february

    For i = m1 To m2 - 1
    If i = 4 Or i = 6 Or i = 9 Or i = 11 Then
    Totaldays = Totaldays + 30
    Else
    If i = 2 Then
    Totaldays = Totaldays + 28
    Else
    Totaldays = Totaldays + 31
    End If
    Next i


    Name = txtname.Text
    Book = txtbook.Text
    CheckMonth = txtcheckmonth.Text
    CheckDay = txtcheckday.Text
    CheckYear = txtcheckyear.Text

    picfee.Print Name; " now owes for the book " & Book; " that was was checked out on " & CheckMonth; "-" & CheckDay; "-" & CheckYear

    End Sub

    Private Sub Form_Load()
    lbldate.Caption = Format(Now, "dddd, mmmm, dd, yyyy")
    m1 = Month(Now)
    d1 = Day(Now)
    y1 = Year(Now)
    txttodaymonth.Text = m1
    txttodayday.Text = d1
    txttodayyear.Text = y1
    End Sub

    Private Sub Timer1_Timer()
    If lbltime.Caption <> CStr(Time) Then
    lbltime.Caption = Time
    End If
    End Sub
    Last edited by Supreme Cookie; Nov 9th, 2002 at 02:21 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width