Sunday, February 5, 2017

Leap Year Checker in Visual Basic NET

Here is a simple program that I wrote in Visual Basic NET that will ask the user to give a year and then our program will check if the given year is a leap year or not a leap year. The code is very short and easy to understand. 

Add me at Facebook my address is jakerpomperada@gmail.com and jakerpomperada@yahoo.com

My email address are the following jakerpomperada@gmail.com and jakerpomperada@yahoo.com

My mobile number here in the Philippines is 09173084360.




Sample Program Output



Program Listing

Public Class Form1

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

        Dim y As Integer

        y = Val(TextBox1.Text)

        If y Mod 100 = 0 Then
            If y Mod 400 = 0 Then
                Label2.Text = " The year " + y.ToString + " is a Leap Year."
            Else
                Label2.Text = " The year " + y.ToString + " is NOT a Leap Year."
            End If
        Else
            If y Mod 4 = 0 Then
                Label2.Text = " The year " + y.ToString + " is a Leap Year."
            Else
                Label2.Text = " The year " + y.ToString + " is NOT a Leap Year."
            End If
        End If

        
    End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        End
    End Sub
End Class



No comments:

Post a Comment