Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 1 of 1
  1. #1
    New to the CF scene
    Join Date
    Nov 2011
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Compiling,,, no go

    Hello everyone.. i am learning C++ and so far i was able to partially make a calculator,, but i have no idea why i cant compile it, and how to fix the errors,, can anyone help me please?? I am using visual basic express



    Code:
    #pragma once
    
    
    
    namespace My3434545 {
    
    	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 My123
    	/// </summary>
    	public ref class My123 : public System::Windows::Forms::Form
    	{
    	public:
    		My123(void)
    		{
    			InitializeComponent();
    			//
    			//TODO: Add the constructor code here
    			//
    		}
    
    	protected:
    		/// <summary>
    		/// Clean up any resources being used.
    		/// </summary>
    		~My123()
    		{
    			if (components)
    			{
    				delete components;
    			}
    		}
    	private: System::Windows::Forms::Panel^  panel1;
    	private: System::Windows::Forms::Button^  button1;
    	private: System::Windows::Forms::Button^  button4;
    	private: System::Windows::Forms::Button^  button3;
    	private: System::Windows::Forms::Button^  button2;
    	private: System::Windows::Forms::TextBox^  textBox1;
    	private: System::Windows::Forms::TextBox^  textBox2;
    	private: System::Windows::Forms::TextBox^  textBox3;
    	private: System::Windows::Forms::TextBox^  textBox4;
    	private: System::Windows::Forms::TextBox^  textBox5;
    	private: System::Windows::Forms::TextBox^  textBox6;
    
    
    	protected: 
    
    	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(My123::typeid));
    			this->panel1 = (gcnew System::Windows::Forms::Panel());
    			this->button4 = (gcnew System::Windows::Forms::Button());
    			this->button3 = (gcnew System::Windows::Forms::Button());
    			this->button2 = (gcnew System::Windows::Forms::Button());
    			this->button1 = (gcnew System::Windows::Forms::Button());
    			this->textBox1 = (gcnew System::Windows::Forms::TextBox());
    			this->textBox2 = (gcnew System::Windows::Forms::TextBox());
    			this->textBox3 = (gcnew System::Windows::Forms::TextBox());
    			this->textBox4 = (gcnew System::Windows::Forms::TextBox());
    			this->textBox5 = (gcnew System::Windows::Forms::TextBox());
    			this->textBox6 = (gcnew System::Windows::Forms::TextBox());
    			this->panel1->SuspendLayout();
    			this->SuspendLayout();
    			// 
    			// panel1
    			// 
    			this->panel1->BackColor = System::Drawing::Color::Transparent;
    			this->panel1->BorderStyle = System::Windows::Forms::BorderStyle::Fixed3D;
    			this->panel1->Controls->Add(this->button4);
    			this->panel1->Controls->Add(this->button3);
    			this->panel1->Controls->Add(this->button2);
    			this->panel1->Controls->Add(this->button1);
    			this->panel1->Cursor = System::Windows::Forms::Cursors::Arrow;
    			this->panel1->Location = System::Drawing::Point(40, 48);
    			this->panel1->Name = L"panel1";
    			this->panel1->Size = System::Drawing::Size(568, 56);
    			this->panel1->TabIndex = 0;
    			this->panel1->Paint += gcnew System::Windows::Forms::PaintEventHandler(this, &My123::panel1_Paint);
    			// 
    			// button4
    			// 
    			this->button4->BackColor = System::Drawing::Color::DarkRed;
    			this->button4->Font = (gcnew System::Drawing::Font(L"Segoe UI", 12, System::Drawing::FontStyle::Bold, System::Drawing::GraphicsUnit::Point, 
    				static_cast<System::Byte>(0)));
    			this->button4->ForeColor = System::Drawing::SystemColors::HighlightText;
    			this->button4->Location = System::Drawing::Point(468, 3);
    			this->button4->Name = L"button4";
    			this->button4->Size = System::Drawing::Size(94, 46);
    			this->button4->TabIndex = 3;
    			this->button4->Text = L"Minus";
    			this->button4->UseVisualStyleBackColor = false;
    			// 
    			// button3
    			// 
    			this->button3->BackColor = System::Drawing::Color::DarkRed;
    			this->button3->Font = (gcnew System::Drawing::Font(L"Segoe UI", 12, System::Drawing::FontStyle::Bold, System::Drawing::GraphicsUnit::Point, 
    				static_cast<System::Byte>(0)));
    			this->button3->ForeColor = System::Drawing::SystemColors::HighlightText;
    			this->button3->Location = System::Drawing::Point(303, 3);
    			this->button3->Name = L"button3";
    			this->button3->Size = System::Drawing::Size(94, 46);
    			this->button3->TabIndex = 2;
    			this->button3->Text = L"Devide";
    			this->button3->UseVisualStyleBackColor = false;
    			this->button3->Click += gcnew System::EventHandler(this, &My123::button3_Click);
    			// 
    			// button2
    			// 
    			this->button2->BackColor = System::Drawing::Color::DarkRed;
    			this->button2->Font = (gcnew System::Drawing::Font(L"Segoe UI", 12, System::Drawing::FontStyle::Bold, System::Drawing::GraphicsUnit::Point, 
    				static_cast<System::Byte>(0)));
    			this->button2->ForeColor = System::Drawing::SystemColors::HighlightText;
    			this->button2->Location = System::Drawing::Point(152, 3);
    			this->button2->Name = L"button2";
    			this->button2->Size = System::Drawing::Size(94, 46);
    			this->button2->TabIndex = 1;
    			this->button2->Text = L"Sum";
    			this->button2->UseVisualStyleBackColor = false;
    			this->button2->Click += gcnew System::EventHandler(this, &My123::button2_Click);
    			// 
    			// button1
    			// 
    			this->button1->BackColor = System::Drawing::Color::DarkRed;
    			this->button1->Font = (gcnew System::Drawing::Font(L"Segoe UI", 12, System::Drawing::FontStyle::Bold, System::Drawing::GraphicsUnit::Point, 
    				static_cast<System::Byte>(0)));
    			this->button1->ForeColor = System::Drawing::SystemColors::HighlightText;
    			this->button1->Location = System::Drawing::Point(3, 3);
    			this->button1->Name = L"button1";
    			this->button1->Size = System::Drawing::Size(94, 46);
    			this->button1->TabIndex = 0;
    			this->button1->Text = L"Multiply";
    			this->button1->UseVisualStyleBackColor = false;
    			this->button1->Click += gcnew System::EventHandler(this, &My123::button1_Click);
    			// 
    			// textBox1
    			// 
    			this->textBox1->Location = System::Drawing::Point(284, 201);
    			this->textBox1->Name = L"textBox1";
    			this->textBox1->Size = System::Drawing::Size(324, 22);
    			this->textBox1->TabIndex = 1;
    			this->textBox1->TextChanged += gcnew System::EventHandler(this, &My123::textBox1_TextChanged);
    			// 
    			// textBox2
    			// 
    			this->textBox2->Location = System::Drawing::Point(284, 303);
    			this->textBox2->Name = L"textBox2";
    			this->textBox2->Size = System::Drawing::Size(324, 22);
    			this->textBox2->TabIndex = 2;
    			// 
    			// textBox3
    			// 
    			this->textBox3->Font = (gcnew System::Drawing::Font(L"Segoe UI", 11.25F, System::Drawing::FontStyle::Bold, System::Drawing::GraphicsUnit::Point, 
    				static_cast<System::Byte>(0)));
    			this->textBox3->Location = System::Drawing::Point(92, 195);
    			this->textBox3->Name = L"textBox3";
    			this->textBox3->ReadOnly = true;
    			this->textBox3->Size = System::Drawing::Size(127, 27);
    			this->textBox3->TabIndex = 3;
    			this->textBox3->Text = L"First Number";
    			this->textBox3->TextChanged += gcnew System::EventHandler(this, &My123::textBox3_TextChanged);
    			// 
    			// textBox4
    			// 
    			this->textBox4->Font = (gcnew System::Drawing::Font(L"Segoe UI", 11.25F, System::Drawing::FontStyle::Bold, System::Drawing::GraphicsUnit::Point, 
    				static_cast<System::Byte>(0)));
    			this->textBox4->Location = System::Drawing::Point(92, 303);
    			this->textBox4->Name = L"textBox4";
    			this->textBox4->ReadOnly = true;
    			this->textBox4->Size = System::Drawing::Size(127, 27);
    			this->textBox4->TabIndex = 4;
    			this->textBox4->Text = L"Second Number";
    			// 
    			// textBox5
    			// 
    			this->textBox5->Location = System::Drawing::Point(241, 449);
    			this->textBox5->Name = L"textBox5";
    			this->textBox5->Size = System::Drawing::Size(167, 22);
    			this->textBox5->TabIndex = 5;
    			// 
    			// textBox6
    			// 
    			this->textBox6->Font = (gcnew System::Drawing::Font(L"Segoe UI", 11.25F, System::Drawing::FontStyle::Bold, System::Drawing::GraphicsUnit::Point, 
    				static_cast<System::Byte>(0)));
    			this->textBox6->Location = System::Drawing::Point(261, 416);
    			this->textBox6->Name = L"textBox6";
    			this->textBox6->ReadOnly = true;
    			this->textBox6->Size = System::Drawing::Size(127, 27);
    			this->textBox6->TabIndex = 6;
    			this->textBox6->Text = L"Result";
    			this->textBox6->TextChanged += gcnew System::EventHandler(this, &My123::textBox6_TextChanged);
    			// 
    			// My123
    			// 
    			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->ClientSize = System::Drawing::Size(677, 538);
    			this->Controls->Add(this->textBox6);
    			this->Controls->Add(this->textBox5);
    			this->Controls->Add(this->textBox4);
    			this->Controls->Add(this->textBox3);
    			this->Controls->Add(this->textBox2);
    			this->Controls->Add(this->textBox1);
    			this->Controls->Add(this->panel1);
    			this->Cursor = System::Windows::Forms::Cursors::Hand;
    			this->Font = (gcnew System::Drawing::Font(L"Segoe UI", 8.25F, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point, 
    				static_cast<System::Byte>(0)));
    			this->ForeColor = System::Drawing::SystemColors::Info;
    			this->FormBorderStyle = System::Windows::Forms::FormBorderStyle::Fixed3D;
    			this->Name = L"My123";
    			this->Text = L"Hadi\'s Caculator!!";
    			this->panel1->ResumeLayout(false);
    			this->ResumeLayout(false);
    			this->PerformLayout();
    
    		}
    #pragma endregion
    	private: System::Void panel1_Paint(System::Object^  sender, System::Windows::Forms::PaintEventArgs^  e) {
    			 }
    	private: System::Void button1_Click(System::Object^  sender, System::EventArgs^  e) 
    	{
        int quantity = 1;
        double unitPrice, subTotal;
    
    	quantity  = int::Parse(textBox3->Text);
    	unitPrice = double::Parse(textBox4->Text); 
    	subTotal  = quantity * unitPrice;
    
    	this->textBox6->Text = subTotal;
    }
    			 private: System::Void textBox1_TextChanged(System::Object^  sender, System::EventArgs^  e)
    
    
    ;
    					private: System::Void button3_Click(System::Object^  sender, System::EventArgs^  e)
    					  {
        int quantity = 1;
        double unitPrice, subTotal;
    
    	quantity  = int::Parse(textBox3->Text);
    	unitPrice = double::Parse(textBox4->Text); 
    	subTotal  = quantity / unitPrice;
    
    	this->textBox6->Text = subTotal.ToString(L"F";
    
    	}
    
    
    	private: System::Void button4_Click(System::Object^  sender, System::EventArgs^  e)
    				 {
        int quantity = 1;
        double unitPrice, subTotal;
    
    	quantity  = int::Parse(textBox3->Text);
    	unitPrice = double::Parse(textBox4->Text); 
    	subTotal  = quantity - unitPrice;
    
    	this->textBox6->Text = subTotal.ToString(L"F";
    }
    
    
    	
    private: System::Void linkLabel1_LinkClicked(System::Object^  sender, System::Windows::Forms::LinkLabelLinkClickedEventArgs^  e) {
    		 }
    private: System::Void richTextBox1_TextChanged(System::Object^  sender, System::EventArgs^  e) {
    		 }
    private: System::Void textBox3_TextChanged(System::Object^  sender, System::EventArgs^  e) {
    		 }
    private: System::Void textBox6_TextChanged(System::Object^  sender, System::EventArgs^  e) {
    		 }
    private: System::Void button2_Click(System::Object^  sender, System::EventArgs^  e) 
    		{
        int quantity = 1;
        double unitPrice, subTotal;
    
    	quantity  = int::Parse(textBox3->Text);
    	unitPrice = double::Parse(textBox4->Text); 
    	subTotal  = quantity + unitPrice;
    
    	this->textBox6->Text = subTotal;
    }
    };
    }
    Last edited by MisT.; 11-11-2011 at 04:54 PM.


 

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •