Application_Development/.vs/Application_Development/v16/.suo
Application_Development/Age_Calculator.cs
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace Application_Development
{
public partial class Age_Calculator : Form
{
public Age_Calculator()
{
InitializeComponent();
}
private void btnSubmit_Click(object sender, EventArgs e)
{
int CurrentYear =Convert.ToInt32( DateTime.Now.Year.ToString());
int EnterYear = Convert.ToInt32(dateTimePicker1.Value.Year.ToString());
int Age = CurrentYear - EnterYear;
if (dateTimePicker1.Value > DateTime.Now)
{
MessageBox.Show("Please enter valid date.");
}
else
{
if(Age<18)
{
MessageBox.Show("Sorry you are not over 18");
}
else if (Age > 18)
{
MessageBox.Show("Welcome to the site you are '"+Age+"'");
}
}
}
private void Form1_Load(object sender, EventArgs e)
{
}
}
}
Application_Development/Age_Calculator.Designer.cs
namespace Application_Development
{
partial class Age_Calculator
{
///
/// Required designer variable.
/// private System.ComponentModel.IContainer components = null;
///
/// Clean up any resources being used.
/// ///
true if managed resources should be disposed; otherwise, false.
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
///
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// private void InitializeComponent()
{
this.label1 = new System.Windows.Forms.Label();
this.dateTimePicker1 = new System.Windows.Forms.DateTimePicker();
this.btnSubmit = new System.Windows.Forms.Button();
this.label2 = new System.Windows.Forms.Label();
this.SuspendLayout();
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(41, 86);
this.label1.Margin = new System.Windows.Forms.Padding(5, 0, 5, 0);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(128, 29);
this.label1.TabIndex = 0;
this.label1.Text = "Enter DOB";
//
// dateTimePicker1
//
this.dateTimePicker1.Location = new System.Drawing.Point(186, 79);
this.dateTimePicker1.Margin = new System.Windows.Forms.Padding(5, 4, 5, 4);
this.dateTimePicker1.Name = "dateTimePicker1";
this.dateTimePicker1.Size = new System.Drawing.Size(309, 35);
this.dateTimePicker1.TabIndex = 1;
//
// btnSubmit
//
this.btnSubmit.Location = new System.Drawing.Point(186, 127);
this.btnSubmit.Margin = new System.Windows.Forms.Padding(5, 4, 5, 4);
this.btnSubmit.Name = "btnSubmit";
this.btnSubmit.Size = new System.Drawing.Size(311, 49);
this.btnSubmit.TabIndex = 2;
this.btnSubmit.Text = "Submit";
this.btnSubmit.UseVisualStyleBackColor = true;
this.btnSubmit.Click += new System.EventHandler(this.btnSubmit_Click);
//
// label2
//
this.label2.Dock = System.Windows.Forms.DockStyle.Top;
this.label2.Location = new System.Drawing.Point(0, 0);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(629, 55);
this.label2.TabIndex = 3;
this.label2.Text = "Age Calculator";
this.label2.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// Form1
//
this.AutoScaleDimensions = new System.Drawing.SizeF(14F, 29F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(629, 251);
this.Controls.Add(this.label2);
this.Controls.Add(this.btnSubmit);
this.Controls.Add(this.dateTimePicker1);
this.Controls.Add(this.label1);
this.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.Margin = new System.Windows.Forms.Padding(5, 4, 5, 4);
this.Name = "Form1";
this.Text = "Form1";
this.Load += new System.EventHandler(this.Form1_Load);
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.Label label1;
private System.Windows.Forms.DateTimePicker...