This is A C# Practice code:
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Linq;
- using System.Text;
- using System.Windows.Forms;
- using System.Data.SqlClient;
- namespace dataentry
- {
- public partial class Age_Calculate : Form
- {
- public Age_Calculate()
- {
- InitializeComponent();
- }
- SqlConnection asdf = new SqlConnection("Data Source=.;Initial Catalog=EManage;Integrated Security=True");
- private void label2_Click(object sender, EventArgs e)
- {
- }
- private void button9_Click_1(object sender, EventArgs e)
- {
- DateTime from = dateTimePicker1.Value;
- DateTime to = DateTime.Now;
- TimeSpan TSpan = to - from;
- double days = TSpan.TotalDays;
- textBox1.Text = (days / 365).ToString("0");
- MessageBox.Show((days / 365).ToString("0"));
- }
- }
- }
Facebook Comment