Visual Basic Programming Code Examples Visual Basic > Date Time Code Examples Check if year is a leap-year Check if year is a leap-year 'make a new project 'add a form 'add a texbox and a commandbutton 'insert the code 'press F5 Option Explicit Private sub Command1_Click() dim strDatum as String If Text1.Text = "" Then exit Sub strDatum = ("29-2-" + Text1.Text) If IsDate(strDatum) Then MsgBox Text1.Text + " is a leap-year." _ Else MsgBox Text1.Text + " isn't a leap-year." End Sub Private sub Form_Load() Text1.Text = Year(Now) End Sub Return