using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
namespace Example70
{
///
/// Summary description for Form1.
///
public class Form1 : System.Windows.Forms.Form
{
private System.Windows.Forms.TextBox textBox1;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.Button button1;
private System.Windows.Forms.Label label5;
private System.Windows.Forms.Label label6;
///
/// Required designer variable.
///
private System.ComponentModel.Container components = null;
public Form1()
{
//
// Required for Windows Form Designer support
//
InitializeComponent();
//
// TODO: Add any constructor code after InitializeComponent call
//
}
///
/// Clean up any resources being used.
///
protected override void Dispose( bool disposing )
{
if( disposing )
{
if (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.textBox1 = new System.Windows.Forms.TextBox();
this.label1 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.label3 = new System.Windows.Forms.Label();
this.label4 = new System.Windows.Forms.Label();
this.button1 = new System.Windows.Forms.Button();
this.label5 = new System.Windows.Forms.Label();
this.label6 = new System.Windows.Forms.Label();
this.SuspendLayout();
//
// textBox1
//
this.textBox1.Location = new System.Drawing.Point(32, 40);
this.textBox1.Name = "textBox1";
this.textBox1.TabIndex = 0;
this.textBox1.Text = "";
//
// label1
//
this.label1.Location = new System.Drawing.Point(160, 39);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(40, 23);
this.label1.TabIndex = 1;
this.label1.Text = "is";
//
// label2
//
this.label2.Location = new System.Drawing.Point(200, 39);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(56, 23);
this.label2.TabIndex = 2;
//
// label3
//
this.label3.Location = new System.Drawing.Point(272, 39);
this.label3.Name = "label3";
this.label3.TabIndex = 3;
//
// label4
//
this.label4.Location = new System.Drawing.Point(32, 80);
this.label4.Name = "label4";
this.label4.TabIndex = 4;
this.label4.Text = "Input cents";
//
// button1
//
this.button1.Location = new System.Drawing.Point(168, 120);
this.button1.Name = "button1";
this.button1.TabIndex = 5;
this.button1.Text = "Calculate";
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// label5
//
this.label5.Location = new System.Drawing.Point(200, 80);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(48, 23);
this.label5.TabIndex = 6;
this.label5.Text = "Dollars";
//
// label6
//
this.label6.Location = new System.Drawing.Point(272, 80);
this.label6.Name = "label6";
this.label6.TabIndex = 7;
this.label6.Text = "Cents";
//
// Form1
//
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
this.ClientSize = new System.Drawing.Size(360, 173);
this.Controls.Add(this.label6);
this.Controls.Add(this.label5);
this.Controls.Add(this.button1);
this.Controls.Add(this.label4);
this.Controls.Add(this.label3);
this.Controls.Add(this.label2);
this.Controls.Add(this.label1);
this.Controls.Add(this.textBox1);
this.Name = "Form1";
this.Text = "Form1";
this.ResumeLayout(false);
}
#endregion
///
/// The main entry point for the application.
///
[STAThread]
static void Main()
{
Application.Run(new Form1());
}
private void button1_Click(object sender, System.EventArgs e)
{
int cents = int.Parse(textBox1.Text);
label2.Text = (cents / 100).ToString();
label3.Text = (cents % 100).ToString();
}
}
}