but I have ran into one problem,The actual function is evaluating to 0 before it makes it to the answer window. I have commented where this occurs and ignore the reset button not doing anything.
#pragma once
namespace AtheabsolutefinalMillCalculator {
using namespace System;
using namespace System::ComponentModel;
using namespace System::Collections;
using namespace System::Windows::Forms;
using namespace System::Data;
using namespace System::Drawing;
/// <summary>
/// Summary for Form1
/// </summary>
public ref class Form1 : public System::Windows::Forms::Form
{
public:
Form1(void)
{
InitializeComponent();
//
//TODO: Add the constructor code here
//
}
protected:
/// <summary>
/// Clean up any resources being used.
/// </summary>
~Form1()
{
if (components)
{
delete components;
}
}
private: System::Windows::Forms::Button^ button1;
protected:
private: System::Windows::Forms::Button^ button2;
private: System::Windows::Forms::Label^ label1;
private: System::Windows::Forms::TextBox^ textBox1;
private: System::Windows::Forms::TextBox^ textBox2;
private: System::Windows::Forms::Label^ label2;
private: System::Windows::Forms::Label^ label3;
private: System::Windows::Forms::TextBox^ AnsLabel;
private: System::Windows::Forms::TextBox^ AnsLabelPM;
private: System::Windows::Forms::Label^ label4;
private: System::Windows::Forms::Label^ label5;
private:
/// <summary>
/// Required designer variable.
/// </summary>
System::ComponentModel::Container ^components;
#pragma 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>
void InitializeComponent(void)
{
System::ComponentModel::ComponentResourceManager^ resources = (gcnew System::ComponentModel::ComponentResourceManager(Form1::typeid));
this->button1 = (gcnew System::Windows::Forms::Button());
this->button2 = (gcnew System::Windows::Forms::Button());
this->label1 = (gcnew System::Windows::Forms::Label());
this->textBox1 = (gcnew System::Windows::Forms::TextBox());
this->textBox2 = (gcnew System::Windows::Forms::TextBox());
this->label2 = (gcnew System::Windows::Forms::Label());
this->label3 = (gcnew System::Windows::Forms::Label());
this->AnsLabel = (gcnew System::Windows::Forms::TextBox());
this->AnsLabelPM = (gcnew System::Windows::Forms::TextBox());
this->label4 = (gcnew System::Windows::Forms::Label());
this->label5 = (gcnew System::Windows::Forms::Label());
this->SuspendLayout();
//
// button1
//
this->button1->Location = System::Drawing::Point(12, 269);
this->button1->Name = L"button1";
this->button1->Size = System::Drawing::Size(215, 54);
this->button1->TabIndex = 0;
this->button1->Text = L"Calculate";
this->button1->UseVisualStyleBackColor = true;
this->button1->Click += gcnew System::EventHandler(this, &Form1::button1_Click);
//
// button2
//
this->button2->Location = System::Drawing::Point(233, 270);
this->button2->Name = L"button2";
this->button2->Size = System::Drawing::Size(217, 53);
this->button2->TabIndex = 1;
this->button2->Text = L"Reset";
this->button2->UseVisualStyleBackColor = true;
//
// label1
//
this->label1->AutoSize = true;
this->label1->Font = (gcnew System::Drawing::Font(L"Lucida Sans", 14.25F, System::Drawing::FontStyle::Bold, System::Drawing::GraphicsUnit::Point,
static_cast<System::Byte>(0)));
this->label1->Location = System::Drawing::Point(52, 19);
this->label1->Name = L"label1";
this->label1->Size = System::Drawing::Size(134, 22);
this->label1->TabIndex = 2;
this->label1->Text = L"House Value";
this->label1->Click += gcnew System::EventHandler(this, &Form1::label1_Click);
//
// textBox1
//
this->textBox1->Location = System::Drawing::Point(17, 44);
this->textBox1->Name = L"textBox1";
this->textBox1->Size = System::Drawing::Size(199, 20);
this->textBox1->TabIndex = 3;
this->textBox1->TextChanged += gcnew System::EventHandler(this, &Form1::textBox1_TextChanged);
//
// textBox2
//
this->textBox2->Location = System::Drawing::Point(17, 109);
this->textBox2->Name = L"textBox2";
this->textBox2->Size = System::Drawing::Size(199, 20);
this->textBox2->TabIndex = 4;
this->textBox2->TextChanged += gcnew System::EventHandler(this, &Form1::textBox2_TextChanged);
//
// label2
//
this->label2->AutoSize = true;
this->label2->Font = (gcnew System::Drawing::Font(L"Lucida Sans", 14.25F, System::Drawing::FontStyle::Bold));
this->label2->Location = System::Drawing::Point(29, 84);
this->label2->Name = L"label2";
this->label2->Size = System::Drawing::Size(173, 22);
this->label2->TabIndex = 5;
this->label2->Text = L"Number of Mills";
//
// label3
//
this->label3->AutoSize = true;
this->label3->Font = (gcnew System::Drawing::Font(L"Lucida Sans", 14.25F, System::Drawing::FontStyle::Bold));
this->label3->Location = System::Drawing::Point(29, 145);
this->label3->Name = L"label3";
this->label3->Size = System::Drawing::Size(91, 22);
this->label3->TabIndex = 6;
this->label3->Text = L"You Pay";
this->label3->Click += gcnew System::EventHandler(this, &Form1::label3_Click);
//
// AnsLabel
//
this->AnsLabel->Location = System::Drawing::Point(17, 170);
this->AnsLabel->Name = L"AnsLabel";
this->AnsLabel->Size = System::Drawing::Size(199, 20);
this->AnsLabel->TabIndex = 7;
//
// AnsLabelPM
//
this->AnsLabelPM->Location = System::Drawing::Point(17, 211);
this->AnsLabelPM->Name = L"AnsLabelPM";
this->AnsLabelPM->Size = System::Drawing::Size(199, 20);
this->AnsLabelPM->TabIndex = 8;
//
// label4
//
this->label4->AutoSize = true;
this->label4->Font = (gcnew System::Drawing::Font(L"Lucida Sans", 14.25F, System::Drawing::FontStyle::Bold));
this->label4->Location = System::Drawing::Point(222, 170);
this->label4->Name = L"label4";
this->label4->Size = System::Drawing::Size(94, 22);
this->label4->TabIndex = 9;
this->label4->Text = L"Per Year";
//
// label5
//
this->label5->AutoSize = true;
this->label5->Font = (gcnew System::Drawing::Font(L"Lucida Sans", 14.25F, System::Drawing::FontStyle::Bold));
this->label5->Location = System::Drawing::Point(222, 211);
this->label5->Name = L"label5";
this->label5->Size = System::Drawing::Size(114, 22);
this->label5->TabIndex = 10;
this->label5->Text = L"Per Month";
//
// Form1
//
this->AutoScaleDimensions = System::Drawing::SizeF(6, 13);
this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
this->BackColor = System::Drawing::SystemColors::AppWorkspace;
this->BackgroundImage = (cli::safe_cast<System::Drawing::Image^ >(resources->GetObject(L"$this.BackgroundImage")));
this->BackgroundImageLayout = System::Windows::Forms::ImageLayout::Stretch;
this->ClientSize = System::Drawing::Size(534, 353);
this->Controls->Add(this->label5);
this->Controls->Add(this->label4);
this->Controls->Add(this->AnsLabelPM);
this->Controls->Add(this->AnsLabel);
this->Controls->Add(this->label3);
this->Controls->Add(this->label2);
this->Controls->Add(this->textBox2);
this->Controls->Add(this->textBox1);
this->Controls->Add(this->label1);
this->Controls->Add(this->button2);
this->Controls->Add(this->button1);
this->Name = L"Form1";
this->Text = L"Mill Calculator";
this->Load += gcnew System::EventHandler(this, &Form1::Form1_Load);
this->ResumeLayout(false);
this->PerformLayout();
}
#pragma endregion //this is where the calculation occurs
int intnum1, intnum2, intnum3, intnum4, intans, intanspm;
private: System::Void Form1_Load(System::Object^ sender, System::EventArgs^ e) {
}
private: System::Void button1_Click(System::Object^ sender, System::EventArgs^ e) {
intnum1=int::Parse(this->textBox1->Text); //This is the calculation, If you need a screenshot I will gladly post one.
intnum2=int::Parse(this->textBox2->Text);
intnum4= intnum1 * .35;
intnum3= intnum2 * .001;
intans= intnum4 * intnum3;
this->AnsLabel->Text=Convert::ToString(intans);
intanspm= intans / 12;
this->AnsLabelPM->Text=Convert::ToString(intanspm);
}
private: System::Void label1_Click(System::Object^ sender, System::EventArgs^ e) {
}
private: System::Void textBox2_TextChanged(System::Object^ sender, System::EventArgs^ e) {
}
private: System::Void label3_Click(System::Object^ sender, System::EventArgs^ e) {
}
private: System::Void textBox1_TextChanged(System::Object^ sender, System::EventArgs^ e) {
}
};
}