you can determine whether a particular year is a leap year or not with the help of IsLeapYear method.
you can use this method as:
IsLeapYear(year As Integer) As Boolean
where year is a 4-digit year.
It returns true if year is a leap year otherwise false.
The following example shows that how we to determine which years between 1990 to 2010 are leap years with the help of IsLeapYear method.
- Private Sub GetLeapYear()
- For year As Integer = 1990 To 2010
- If DateTime.IsLeapYear(year) Then
- MessageBox.Show(year & " is a leap year.")
- End If
- End Sub