using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;

namespace ComputeInterest
{
/// <summary>
/// Summary description for Form1.
/// </summary>
public class Form1 : System.Windows.Forms.Form
{
private System.Windows.Forms.Label lblPrincipal;
private System.Windows.Forms.Label lblRate;
private System.Windows.Forms.Label lblYears;
private System.Windows.Forms.TextBox txtPrincipal;
private System.Windows.Forms.TextBox txtYears;
private System.Windows.Forms.Label lblTotal;
private System.Windows.Forms.TextBox txtRate;
private System.Windows.Forms.Label lblTotalResult;
private System.Windows.Forms.Button btn_computeInterest;
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.Container components = null;

public Form1()
{
//
// Required for Windows Form Designer support
//
InitializeComponent();

//
// TODO: Add any constructor code after InitializeComponent call
//
}

/// <summary>
/// Clean up any resources being used.
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if (components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}

#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.lblPrincipal = new System.Windows.Forms.Label();
this.lblRate = new System.Windows.Forms.Label();
this.lblYears = new System.Windows.Forms.Label();
this.txtPrincipal = new System.Windows.Forms.TextBox();
this.txtYears = new System.Windows.Forms.TextBox();
this.lblTotal = new System.Windows.Forms.Label();
this.txtRate = new System.Windows.Forms.TextBox();
this.lblTotalResult = new System.Windows.Forms.Label();
this.btn_computeInterest = new System.Windows.Forms.Button();
this.SuspendLayout();
//
// lblPrincipal
//
this.lblPrincipal.Location = new System.Drawing.Point(24, 32);
this.lblPrincipal.Name = "lblPrincipal";
this.lblPrincipal.TabIndex = 0;
this.lblPrincipal.Text = "Principal";
//
// lblRate
//
this.lblRate.Location = new System.Drawing.Point(24, 72);
this.lblRate.Name = "lblRate";
this.lblRate.TabIndex = 1;
this.lblRate.Text = "Interest Rate";
//
// lblYears
//
this.lblYears.Location = new System.Drawing.Point(24, 112);
this.lblYears.Name = "lblYears";
this.lblYears.TabIndex = 2;
this.lblYears.Text = "Number of Years";
//
// txtPrincipal
//
this.txtPrincipal.Location = new System.Drawing.Point(152, 32);
this.txtPrincipal.Name = "txtPrincipal";
this.txtPrincipal.TabIndex = 3;
this.txtPrincipal.Text = "";
//
// txtYears
//
this.txtYears.Location = new System.Drawing.Point(152, 112);
this.txtYears.Name = "txtYears";
this.txtYears.TabIndex = 5;
this.txtYears.Text = "";
//
// lblTotal
//
this.lblTotal.Location = new System.Drawing.Point(24, 160);
this.lblTotal.Name = "lblTotal";
this.lblTotal.TabIndex = 6;
this.lblTotal.Text = "Total Interest";
//
// txtRate
//
this.txtRate.Location = new System.Drawing.Point(152, 72);
this.txtRate.Name = "txtRate";
this.txtRate.TabIndex = 4;
this.txtRate.Text = "";
//
// lblTotalResult
//
this.lblTotalResult.BackColor = System.Drawing.Color.Red;
this.lblTotalResult.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
this.lblTotalResult.FlatStyle = System.Windows.Forms.FlatStyle.System;
this.lblTotalResult.Location = new System.Drawing.Point(152, 160);
this.lblTotalResult.Name = "lblTotalResult";
this.lblTotalResult.TabIndex = 7;
//
// btn_computeInterest
//
this.btn_computeInterest.Location = new System.Drawing.Point(88, 224);
this.btn_computeInterest.Name = "btn_computeInterest";
this.btn_computeInterest.Size = new System.Drawing.Size(104, 23);
this.btn_computeInterest.TabIndex = 8;
this.btn_computeInterest.Text = "Compute Interest";
this.btn_computeInterest.Click += new System.EventHandler(this.btn_computeInterest_Click);
//
// Form1
//
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
this.ClientSize = new System.Drawing.Size(292, 273);
this.Controls.AddRange(new System.Windows.Forms.Control[] {
this.btn_computeInterest,
this.lblTotalResult,
this.lblTotal,
this.txtYears,
this.txtRate,
this.txtPrincipal,
this.lblYears,
this.lblRate,
this.lblPrincipal});
this.Name = "Form1";
this.ResumeLayout(false);

}
#endregion

/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
Application.Run(new Form1());
}

private void btn_computeInterest_Click(object sender, System.EventArgs e)
{
float interest;
interest = float.Parse(txtPrincipal.Text) * (float.Parse(txtRate.Text))*0.01F * int.Parse(txtYears.Text);
lblTotalResult.Text = interest.ToString("C");
}

}
}