Hey,
I created a simple program that tells the user the number of days in a month after they enter the number of the month for the year they are in, however I need to now allow for leap years...I read the vb help files and discovered this code but I do not know how to implent it to my source code:-
Function bIsLeapYear(ByVal inYear As Integer) As Boolean
bIsLeapYear = ((inYear Mod 4 = 0) _
And (inYear Mod 100 <> 0) _
Or (inYear Mod 400 = 0))
Please can someone tell me how to use it in my below source code:-
thanks in advance...Code:Option Explicit Dim Month As Integer Private Sub cmdMonth_Click() Month = InputBox("Please enter a month 1 to 12") If Month < "1" Then MsgBox "Please enter a number between 1 and 12" Else If Month > "12" Then MsgBox "Please enter a number between 1 and 12" End If End If Select Case Month Case 1, 3, 5, 7, 8, 10, 12 txtDays.Text = 31 Case 4, 6, 9, 11 txtDays.Text = 30 Case 2 txtDays.Text = "28" End Select End Sub
cheers




Reply With Quote