WizIQ helps you learn and teach online - any subject you can think of!
Join for FREE

Introduction to Visual C#

Add to Favourites
Post to:

D:\WizIQ\Timeshow\Timeshow\Form1.Designer.cs 1 namespace Timeshow { partial class Form1 { ///

///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.GetTime = new System.Windows.Forms.Button(); this.label1 = new System.Windows.Forms.Label(); this.Hourtxt = new System.Windows.Forms.TextBox(); this.Munitetxt = new System.Windows.Forms.TextBox(); this.label2 = new System.Windows.Forms.Label(); this.Secondtxt = new System.Windows.Forms.TextBox(); this.label3 = new System.Windows.Forms.Label(); this.label4 = new System.Windows.Forms.Label(); this.Exit = new System.Windows.Forms.Button(); this.SuspendLayout(); ////GetTime //this.GetTime.Location = new System.Drawing.Point(79, 94); this.GetTime.Name = "GetTime"; this.GetTime.Size = new System.Drawing.Size(75, 23); this.GetTime.TabIndex = 0; this.GetTime.Text = "Get Time"; this.GetTime.UseVisualStyleBackColor = true; this.GetTime.Click += new System.EventHandler(this.GetTime_Click); ////label1 //this.label1.AutoSize = true; this.label1.Location = new System.Drawing.Point(13, 51); this.label1.Name = "label1"; this.label1.Size = new System.Drawing.Size(30, 13); this.label1.TabIndex = 1; this.label1.Text = "Hour"; ////Hourtxt //this.Hourtxt.Location = new System.Drawing.Point(48, 51); this.Hourtxt.Name = "Hourtxt"; this.Hourtxt.Size = new System.Drawing.Size(41, 20);D:\WizIQ\Timeshow\Timeshow\Form1.Designer.cs 2 this.Hourtxt.TabIndex = 2; ////Munitetxt //this.Munitetxt.Location = new System.Drawing.Point(134, 51); this.Munitetxt.Name = "Munitetxt"; this.Munitetxt.Size = new System.Drawing.Size(41, 20); this.Munitetxt.TabIndex = 4; ////label2 //this.label2.AutoSize = true; this.label2.Location = new System.Drawing.Point(95, 51); this.label2.Name = "label2"; this.label2.Size = new System.Drawing.Size(39, 13); this.label2.TabIndex = 3; this.label2.Text = "Munite"; ////Secondtxt //this.Secondtxt.Location = new System.Drawing.Point(227, 51); this.Secondtxt.Name = "Secondtxt"; this.Secondtxt.Size = new System.Drawing.Size(41, 20); this.Secondtxt.TabIndex = 6; ////label3 //this.label3.AutoSize = true; this.label3.Location = new System.Drawing.Point(181, 51); this.label3.Name = "label3"; this.label3.Size = new System.Drawing.Size(44, 13); this.label3.TabIndex = 5; this.label3.Text = "Second"; ////label4 //this.label4.AutoSize = true; this.label4.Font = new System.Drawing.Font("Microsoft Sans Serif", 10F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.label4.Location = new System.Drawing.Point(100, 9); this.label4.Name = "label4"; this.label4.Size = new System.Drawing.Size(72, 17); this.label4.TabIndex = 7; this.label4.Text = "Set Time"; ////Exit //this.Exit.Location = new System.Drawing.Point(173, 94); this.Exit.Name = "Exit"; this.Exit.Size = new System.Drawing.Size(75, 23); this.Exit.TabIndex = 8; this.Exit.Text = "Exit"; this.Exit.UseVisualStyleBackColor = true; this.Exit.Click += new System.EventHandler(this.Exit_Click); ////Form1 //this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(280, 129); this.ControlBox = false; this.Controls.Add(this.Exit); this.Controls.Add(this.label4); this.Controls.Add(this.Secondtxt); this.Controls.Add(this.label3); this.Controls.Add(this.Munitetxt);D:\WizIQ\Timeshow\Timeshow\Form1.Designer.cs 3 this.Controls.Add(this.label2); this.Controls.Add(this.Hourtxt); this.Controls.Add(this.label1); this.Controls.Add(this.GetTime); this.Name = "Form1"; this.Text = "Display Time "; this.ResumeLayout(false); this.PerformLayout(); } #endregion private System.Windows.Forms.Button GetTime; private System.Windows.Forms.Label label1; private System.Windows.Forms.TextBox Hourtxt; private System.Windows.Forms.TextBox Munitetxt; private System.Windows.Forms.Label label2; private System.Windows.Forms.TextBox Secondtxt; private System.Windows.Forms.Label label3; private System.Windows.Forms.Label label4; private System.Windows.Forms.Button Exit; } }D:\WizIQ\Timeshow\Timeshow\Form1.cs 1 using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; namespace Timeshow { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void GetTime_Click(object sender, EventArgs e) { DateTime Presenttime; Presenttime = DateTime.Now; int hour; int munite; int second; hour = Presenttime.Hour; munite = Presenttime.Minute; second = Presenttime.Second; int Sethour = int.Parse(Hourtxt.Text); int Setmunit =int.Parse(Munitetxt.Text); int Setsecond =int.Parse(Secondtxt.Text); int hourdiff =(hour-Sethour); int munitediff = (munite -Setmunit); int setsecdiff = (second -Setsecond); if (Sethour <= hour && Setmunit <= munite && Setsecond <= second) { Console.Beep(); MessageBox.Show("Your Set Time is: "+ Sethour.ToString() + ":" + Setmunit + ":" + Setsecond + "\n You have exceeded the Time by: " + hourdiff + " :" + munitediff + ":" + setsecdiff, "Your Set Time is", MessageBoxButtons. OK); } else { Console.Beep(); MessageBox.Show("Please waite for the time" + "Thank you\n" + "But Current time is:" + hour.ToString() + ":" + munite + ":" + second, "Your set time is", MessageBoxButtons.OK); } } private void Exit_Click(object sender, EventArgs e) { Application.Exit(); } } }

Description
An application to set time and display it

Comments

Want to learn?

Sign up and browse through relevant courses.

Name:
Your Email:
Password:
Country:
Contact no.:


Area code Number
Subject you are interested in:
Word verification: (Enter the text as in image)


Sign Up Already a member? Sign In
I agree to WizIQ's User Agreement & Privacy Policy
1 Follower

Your Facebook Friends on WizIQ