![]()
![]()
![]()
![]()
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




Reply With Quote