2013-09-23 374 views
0

我很新的c + +,我正在寫一個虛擬的信用計算器!這是我的代碼:Windows窗體應用程序錯誤

PS:不知道我是德國人,所以可能會有一些德語單詞,但我不這麼認爲!

#pragma once 

namespace HypothekenRechner { 

    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 
    { 
    int Year [100]; 
    int Mone[100]; 
    int Interes[100]; 
    int Redemptio[100]; 
    int c; 
    int Money; 
    int Percent; 
    int Interest; 
    int tp; 
    int Redemption; 

    public: 

    private: System::Windows::Forms::Button^ button1; 
    private: System::Windows::Forms::TextBox^ textBox5; 
    private: System::Windows::Forms::TextBox^ textBox6; 
    private: System::Windows::Forms::TextBox^ textBox7; 
    private: System::Windows::Forms::TextBox^ textBox8; 
    private: System::Windows::Forms::Label^ label6; 
    private: System::Windows::Forms::Label^ label7; 
    private: System::Windows::Forms::Label^ label8; 
    private: System::Windows::Forms::Label^ label9; 
    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::TextBox^ textBox1; 
    protected: 
    private: System::Windows::Forms::TextBox^ textBox2; 
    private: System::Windows::Forms::TextBox^ textBox3; 
    private: System::Windows::Forms::TextBox^ textBox4; 
    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::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->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->label1 = (gcnew System::Windows::Forms::Label()); 
      this->label2 = (gcnew System::Windows::Forms::Label()); 
      this->label3 = (gcnew System::Windows::Forms::Label()); 
      this->label4 = (gcnew System::Windows::Forms::Label()); 
      this->label5 = (gcnew System::Windows::Forms::Label()); 
      this->button1 = (gcnew System::Windows::Forms::Button()); 
      this->textBox5 = (gcnew System::Windows::Forms::TextBox()); 
      this->textBox6 = (gcnew System::Windows::Forms::TextBox()); 
      this->textBox7 = (gcnew System::Windows::Forms::TextBox()); 
      this->textBox8 = (gcnew System::Windows::Forms::TextBox()); 
      this->label6 = (gcnew System::Windows::Forms::Label()); 
      this->label7 = (gcnew System::Windows::Forms::Label()); 
      this->label8 = (gcnew System::Windows::Forms::Label()); 
      this->label9 = (gcnew System::Windows::Forms::Label()); 
      this->SuspendLayout(); 
      // 
      // textBox1 
      // 
      this->textBox1->Location = System::Drawing::Point(158, 12); 
      this->textBox1->Name = L"textBox1"; 
      this->textBox1->Size = System::Drawing::Size(100, 20); 
      this->textBox1->TabIndex = 0; 
      // 
      // textBox2 
      // 
      this->textBox2->Location = System::Drawing::Point(158, 38); 
      this->textBox2->Name = L"textBox2"; 
      this->textBox2->Size = System::Drawing::Size(100, 20); 
      this->textBox2->TabIndex = 1; 
      // 
      // textBox3 
      // 
      this->textBox3->Location = System::Drawing::Point(158, 64); 
      this->textBox3->Name = L"textBox3"; 
      this->textBox3->Size = System::Drawing::Size(100, 20); 
      this->textBox3->TabIndex = 2; 
      // 
      // textBox4 
      // 
      this->textBox4->Location = System::Drawing::Point(158, 90); 
      this->textBox4->Name = L"textBox4"; 
      this->textBox4->Size = System::Drawing::Size(100, 20); 
      this->textBox4->TabIndex = 3; 
      // 
      // label1 
      // 
      this->label1->AutoSize = true; 
      this->label1->BackColor = System::Drawing::Color::Transparent; 
      this->label1->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 11.25F, System::Drawing::FontStyle::Bold, System::Drawing::GraphicsUnit::Point, 
       static_cast<System::Byte>(0))); 
      this->label1->ForeColor = System::Drawing::Color::Black; 
      this->label1->Location = System::Drawing::Point(1, 14); 
      this->label1->Name = L"label1"; 
      this->label1->Size = System::Drawing::Size(79, 18); 
      this->label1->TabIndex = 4; 
      this->label1->Text = L"Hypothek"; 
      // 
      // label2 
      // 
      this->label2->AutoSize = true; 
      this->label2->BackColor = System::Drawing::Color::Transparent; 
      this->label2->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 11.25F, System::Drawing::FontStyle::Bold, System::Drawing::GraphicsUnit::Point, 
       static_cast<System::Byte>(0))); 
      this->label2->ForeColor = System::Drawing::Color::Black; 
      this->label2->Location = System::Drawing::Point(1, 40); 
      this->label2->Name = L"label2"; 
      this->label2->Size = System::Drawing::Size(72, 18); 
      this->label2->TabIndex = 5; 
      this->label2->Text = L"Zinssatz"; 
      // 
      // label3 
      // 
      this->label3->AutoSize = true; 
      this->label3->BackColor = System::Drawing::Color::Transparent; 
      this->label3->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 11.25F, System::Drawing::FontStyle::Bold, System::Drawing::GraphicsUnit::Point, 
       static_cast<System::Byte>(0))); 
      this->label3->ForeColor = System::Drawing::Color::Black; 
      this->label3->Location = System::Drawing::Point(1, 66); 
      this->label3->Name = L"label3"; 
      this->label3->Size = System::Drawing::Size(140, 18); 
      this->label3->TabIndex = 6; 
      this->label3->Text = L"Jährliche Zahlung"; 
      // 
      // label4 
      // 
      this->label4->AutoSize = true; 
      this->label4->BackColor = System::Drawing::Color::Transparent; 
      this->label4->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 11.25F, System::Drawing::FontStyle::Bold, System::Drawing::GraphicsUnit::Point, 
       static_cast<System::Byte>(0))); 
      this->label4->ForeColor = System::Drawing::Color::Black; 
      this->label4->Location = System::Drawing::Point(1, 92); 
      this->label4->Name = L"label4"; 
      this->label4->Size = System::Drawing::Size(62, 18); 
      this->label4->TabIndex = 7; 
      this->label4->Text = L"Tilgung"; 
      // 
      // label5 
      // 
      this->label5->AutoSize = true; 
      this->label5->BackColor = System::Drawing::Color::Transparent; 
      this->label5->Font = (gcnew System::Drawing::Font(L"Segoe Script", 24, System::Drawing::FontStyle::Bold, System::Drawing::GraphicsUnit::Point, 
       static_cast<System::Byte>(0))); 
      this->label5->ForeColor = System::Drawing::Color::Black; 
      this->label5->Location = System::Drawing::Point(12, 238); 
      this->label5->Name = L"label5"; 
      this->label5->Size = System::Drawing::Size(256, 53); 
      this->label5->TabIndex = 8; 
      this->label5->Text = L"Tobias Rohde"; 
      // 
      // button1 
      // 
      this->button1->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 14.25F, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point, 
       static_cast<System::Byte>(0))); 
      this->button1->ForeColor = System::Drawing::SystemColors::ControlText; 
      this->button1->Location = System::Drawing::Point(338, 248); 
      this->button1->Name = L"button1"; 
      this->button1->Size = System::Drawing::Size(150, 40); 
      this->button1->TabIndex = 9; 
      this->button1->Text = L"Berechnen"; 
      this->button1->UseVisualStyleBackColor = true; 
      this->button1->Click += gcnew System::EventHandler(this, &Form1::button1_Click); 
      // 
      // textBox5 
      // 
      this->textBox5->Location = System::Drawing::Point(388, 12); 
      this->textBox5->Name = L"textBox5"; 
      this->textBox5->Size = System::Drawing::Size(100, 20); 
      this->textBox5->TabIndex = 10; 
      // 
      // textBox6 
      // 
      this->textBox6->Location = System::Drawing::Point(388, 41); 
      this->textBox6->Name = L"textBox6"; 
      this->textBox6->Size = System::Drawing::Size(100, 20); 
      this->textBox6->TabIndex = 11; 
      // 
      // textBox7 
      // 
      this->textBox7->Location = System::Drawing::Point(388, 67); 
      this->textBox7->Name = L"textBox7"; 
      this->textBox7->Size = System::Drawing::Size(100, 20); 
      this->textBox7->TabIndex = 12; 
      // 
      // textBox8 
      // 
      this->textBox8->Location = System::Drawing::Point(388, 92); 
      this->textBox8->Name = L"textBox8"; 
      this->textBox8->Size = System::Drawing::Size(100, 20); 
      this->textBox8->TabIndex = 13; 
      // 
      // label6 
      // 
      this->label6->AutoSize = true; 
      this->label6->BackColor = System::Drawing::Color::Transparent; 
      this->label6->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 11.25F, System::Drawing::FontStyle::Bold, System::Drawing::GraphicsUnit::Point, 
       static_cast<System::Byte>(0))); 
      this->label6->ForeColor = System::Drawing::Color::Black; 
      this->label6->Location = System::Drawing::Point(282, 14); 
      this->label6->Name = L"label6"; 
      this->label6->Size = System::Drawing::Size(41, 18); 
      this->label6->TabIndex = 14; 
      this->label6->Text = L"Jahr"; 
      // 
      // label7 
      // 
      this->label7->AutoSize = true; 
      this->label7->BackColor = System::Drawing::Color::Transparent; 
      this->label7->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 11.25F, System::Drawing::FontStyle::Bold, System::Drawing::GraphicsUnit::Point, 
       static_cast<System::Byte>(0))); 
      this->label7->ForeColor = System::Drawing::Color::Black; 
      this->label7->Location = System::Drawing::Point(282, 43); 
      this->label7->Name = L"label7"; 
      this->label7->Size = System::Drawing::Size(92, 18); 
      this->label7->TabIndex = 15; 
      this->label7->Text = L"Restschuld"; 
      // 
      // label8 
      // 
      this->label8->AutoSize = true; 
      this->label8->BackColor = System::Drawing::Color::Transparent; 
      this->label8->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 11.25F, System::Drawing::FontStyle::Bold, System::Drawing::GraphicsUnit::Point, 
       static_cast<System::Byte>(0))); 
      this->label8->ForeColor = System::Drawing::Color::Black; 
      this->label8->Location = System::Drawing::Point(282, 69); 
      this->label8->Name = L"label8"; 
      this->label8->Size = System::Drawing::Size(58, 18); 
      this->label8->TabIndex = 16; 
      this->label8->Text = L"Zinsen"; 
      // 
      // label9 
      // 
      this->label9->AutoSize = true; 
      this->label9->BackColor = System::Drawing::Color::Transparent; 
      this->label9->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 11.25F, System::Drawing::FontStyle::Bold, System::Drawing::GraphicsUnit::Point, 
       static_cast<System::Byte>(0))); 
      this->label9->ForeColor = System::Drawing::Color::Black; 
      this->label9->Location = System::Drawing::Point(282, 94); 
      this->label9->Name = L"label9"; 
      this->label9->Size = System::Drawing::Size(62, 18); 
      this->label9->TabIndex = 17; 
      this->label9->Text = L"Tilgung"; 
      // 
      // Form1 
      // 
      this->AutoScaleDimensions = System::Drawing::SizeF(6, 13); 
      this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font; 
      this->BackgroundImage = (cli::safe_cast<System::Drawing::Image^ >(resources->GetObject(L"$this.BackgroundImage"))); 
      this->ClientSize = System::Drawing::Size(500, 300); 
      this->Controls->Add(this->label9); 
      this->Controls->Add(this->label8); 
      this->Controls->Add(this->label7); 
      this->Controls->Add(this->label6); 
      this->Controls->Add(this->textBox8); 
      this->Controls->Add(this->textBox7); 
      this->Controls->Add(this->textBox6); 
      this->Controls->Add(this->textBox5); 
      this->Controls->Add(this->button1); 
      this->Controls->Add(this->label5); 
      this->Controls->Add(this->label4); 
      this->Controls->Add(this->label3); 
      this->Controls->Add(this->label2); 
      this->Controls->Add(this->label1); 
      this->Controls->Add(this->textBox4); 
      this->Controls->Add(this->textBox3); 
      this->Controls->Add(this->textBox2); 
      this->Controls->Add(this->textBox1); 
      this->Name = L"Form1"; 
      this->Text = L"Hypotheken Rechner by Tobias Rohde"; 
      this->Load += gcnew System::EventHandler(this, &Form1::Form1_Load); 
      this->ResumeLayout(false); 
      this->PerformLayout(); 

     } 
#pragma endregion 

    private: System::Void button1_Click(System::Object^ sender, System::EventArgs^ e) { 
     for(c=0;c<100;c++){ 
     Money=Money-Redemption; 
     Mone[c]=Money; 
     Interes[c]=Money*Percent/100; 
     Redemption = tp-Zinse[c]; //tp to pay 
     Redemptio[c]=Redemption; 
    } 
     for(c=0;c<100;c++){ 
      textBox5->Text = Year[c]; 
      textBox6->Text = Mone[c]; 
      textBox7->Text = Interes[c]; 
      textBox8->Text = Redemptio[c]; 
      if(Mone[c]<=0) 
     { 
      break; 
     } 
     } 
      } 
}; 
} 

我收到此錯誤:

1>------ Build started: Project: Hypotheken Rechner, Configuration: Debug Win32 ------ 
1> Hypotheken Rechner.cpp 
1>c:\users\tobi\documents\visual studio 2010\projects\hypotheken rechner\hypotheken rechner\Form1.h(17): error C4368: cannot define 'Year' as a member of managed 'HypothekenRechner::Form1': mixed types are not supported 
1>c:\users\tobi\documents\visual studio 2010\projects\hypotheken rechner\hypotheken rechner\Form1.h(18): error C4368: cannot define 'Mone' as a member of managed 'HypothekenRechner::Form1': mixed types are not supported 
1>c:\users\tobi\documents\visual studio 2010\projects\hypotheken rechner\hypotheken rechner\Form1.h(19): error C4368: cannot define 'Interes' as a member of managed 'HypothekenRechner::Form1': mixed types are not supported 
1>c:\users\tobi\documents\visual studio 2010\projects\hypotheken rechner\hypotheken rechner\Form1.h(20): error C4368: cannot define 'Redemptio' as a member of managed 'HypothekenRechner::Form1': mixed types are not supported 
1>c:\users\tobi\documents\visual studio 2010\projects\hypotheken rechner\hypotheken rechner\Form1.h(319): error C2039: 'Form1_Load' : is not a member of 'HypothekenRechner::Form1' 
1>   c:\users\tobi\documents\visual studio 2010\projects\hypotheken rechner\hypotheken rechner\Form1.h(15) : see declaration of 'HypothekenRechner::Form1' 
1>c:\users\tobi\documents\visual studio 2010\projects\hypotheken rechner\hypotheken rechner\Form1.h(319): error C2065: 'Form1_Load' : undeclared identifier 
1>c:\users\tobi\documents\visual studio 2010\projects\hypotheken rechner\hypotheken rechner\Form1.h(319): error C3350: 'System::EventHandler' : a delegate constructor expects 2 argument(s) 
1>c:\users\tobi\documents\visual studio 2010\projects\hypotheken rechner\hypotheken rechner\Form1.h(332): error C2065: 'Zinse' : undeclared identifier 
1>c:\users\tobi\documents\visual studio 2010\projects\hypotheken rechner\hypotheken rechner\Form1.h(336): error C2664: 'void System::Windows::Forms::Control::Text::set(System::String ^)' : cannot convert parameter 1 from 'int' to 'System::String ^' 
1>   No user-defined-conversion operator available, or 
1>   No standard conversion exists from the boxed form of the arithmetic type to the target type 
1>c:\users\tobi\documents\visual studio 2010\projects\hypotheken rechner\hypotheken rechner\Form1.h(337): error C2664: 'void System::Windows::Forms::Control::Text::set(System::String ^)' : cannot convert parameter 1 from 'int' to 'System::String ^' 
1>   No user-defined-conversion operator available, or 
1>   No standard conversion exists from the boxed form of the arithmetic type to the target type 
1>c:\users\tobi\documents\visual studio 2010\projects\hypotheken rechner\hypotheken rechner\Form1.h(338): error C2664: 'void System::Windows::Forms::Control::Text::set(System::String ^)' : cannot convert parameter 1 from 'int' to 'System::String ^' 
1>   No user-defined-conversion operator available, or 
1>   No standard conversion exists from the boxed form of the arithmetic type to the target type 
1>c:\users\tobi\documents\visual studio 2010\projects\hypotheken rechner\hypotheken rechner\Form1.h(339): error C2664: 'void System::Windows::Forms::Control::Text::set(System::String ^)' : cannot convert parameter 1 from 'int' to 'System::String ^' 
1>   No user-defined-conversion operator available, or 
1>   No standard conversion exists from the boxed form of the arithmetic type to the target type 
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ========== 

我嘗試了很多的東西來解決這個問題,我讀了很多關於構造函數和有關管理和一成不變的東西一些東西,得到一些declerations .. 。請幫我解決這個問題!

+0

這是一個非常不健康的C++/CLI和C代碼混合,C++/CLI編譯器不會忍受它。您需要閱讀至少一本關於C++/CLI編程的入門書籍,以瞭解如何正確編寫這類代碼。如使用數組<>關鍵字來聲明託管數組。拜訪當地的書店或圖書館以取得成功。 –

+0

... du musst dringend nochmal von ganz vorne anfangen,ganz offensichtlich kennst du die Makros #include und dasSchlüsselwortusing nicht。 Ehrlich gesagt:mit deinem Wissensstand sollte man nicht programmieren。 – specializt

+0

@specializt,klar kenne ich ich die ich lese gerade so ein buch namens在24小時學習C++ um die Basics zu verstehen。 ich sagte ja ich bin noch nicht so gut! –

回答

0

第一個問題是,當你與裁判定義類:

public ref class Form1 

你做你的類進行管理。並且字符串不受管理。所以你基本上是在不允許的託管類中定義unmanged成員。

+0

好的謝謝!我該如何解決這個問題?作爲其他人提到的 –

+0

這不是一個非常健康的代碼。但如果你堅持,你可以嘗試使用字符串^來表示應該自動管理字符串,並使用System :: Array。但我建議你在使用之前先仔細閱讀CLI/C++。順便說一句,你有另一個問題是,你嘗試設置一個整數的文本,而沒有自動轉換。 – user844541

+0

是的,我認爲你是對的......!我以爲控制檯應用程序代碼是一樣的形式..我的錯!但你能幫我解決嗎? –

0

所以我編輯它像你說的:)我現在只得到3或4錯誤。 (我編輯了一些其他的東西,但不要讓錯誤出現!)

#pragma once 

    namespace HypothekenRechner { 

     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 
     { 
     array<int>^Year; 
     array<int>^Mone; 
     array<int>^Interes; 
     array<int>^Redemptio; 

     int c; 
     int Money; 
     int Percent; 
     int Interest; 
     int tp; 
     int Redemption; 
     int Yeaar; 
     public: 

     private: System::Windows::Forms::Button^ button1; 
     private: System::Windows::Forms::TextBox^ textBox5; 
     private: System::Windows::Forms::TextBox^ textBox6; 
     private: System::Windows::Forms::TextBox^ textBox7; 
     private: System::Windows::Forms::TextBox^ textBox8; 
     private: System::Windows::Forms::Label^ label6; 
     private: System::Windows::Forms::Label^ label7; 
     private: System::Windows::Forms::Label^ label8; 
     private: System::Windows::Forms::Label^ label10; 
     private: System::Windows::Forms::TextBox^ textBox9; 
     private: System::Windows::Forms::Button^ button2; 
     private: System::Windows::Forms::Label^ label9; 
     public: 

      Form1(void) 
      { 
       InitializeComponent(); 

       Year= gcnew array<int>(100); 
       Mone= gcnew array<int>(100); 
       Interes= gcnew array<int>(100); 
       Redemptio= gcnew array<int>(100); 
       // 
       //TODO: Add the constructor code here 
       // 
      } 

     protected: 
      /// <summary> 
      /// Clean up any resources being used. 
      /// </summary> 
      ~Form1() 
      { 
       if (components) 
       { 
        delete components; 
       } 
      } 
     private: System::Windows::Forms::TextBox^ textBox1; 
     protected: 
     private: System::Windows::Forms::TextBox^ textBox2; 
     private: System::Windows::Forms::TextBox^ textBox3; 
     private: System::Windows::Forms::TextBox^ textBox4; 
     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::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->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->label1 = (gcnew System::Windows::Forms::Label()); 
       this->label2 = (gcnew System::Windows::Forms::Label()); 
       this->label3 = (gcnew System::Windows::Forms::Label()); 
       this->label4 = (gcnew System::Windows::Forms::Label()); 
       this->label5 = (gcnew System::Windows::Forms::Label()); 
       this->button1 = (gcnew System::Windows::Forms::Button()); 
       this->textBox5 = (gcnew System::Windows::Forms::TextBox()); 
       this->textBox6 = (gcnew System::Windows::Forms::TextBox()); 
       this->textBox7 = (gcnew System::Windows::Forms::TextBox()); 
       this->textBox8 = (gcnew System::Windows::Forms::TextBox()); 
       this->label6 = (gcnew System::Windows::Forms::Label()); 
       this->label7 = (gcnew System::Windows::Forms::Label()); 
       this->label8 = (gcnew System::Windows::Forms::Label()); 
       this->label9 = (gcnew System::Windows::Forms::Label()); 
       this->label10 = (gcnew System::Windows::Forms::Label()); 
       this->textBox9 = (gcnew System::Windows::Forms::TextBox()); 
       this->button2 = (gcnew System::Windows::Forms::Button()); 
       this->SuspendLayout(); 
       // 
       // textBox1 
       // 
       this->textBox1->Location = System::Drawing::Point(158, 12); 
       this->textBox1->Name = L"textBox1"; 
       this->textBox1->Size = System::Drawing::Size(100, 20); 
       this->textBox1->TabIndex = 0; 
       // 
       // textBox2 
       // 
       this->textBox2->Location = System::Drawing::Point(158, 38); 
       this->textBox2->Name = L"textBox2"; 
       this->textBox2->Size = System::Drawing::Size(100, 20); 
       this->textBox2->TabIndex = 1; 
       // 
       // textBox3 
       // 
       this->textBox3->Location = System::Drawing::Point(158, 64); 
       this->textBox3->Name = L"textBox3"; 
       this->textBox3->Size = System::Drawing::Size(100, 20); 
       this->textBox3->TabIndex = 2; 
       // 
       // textBox4 
       // 
       this->textBox4->Location = System::Drawing::Point(158, 90); 
       this->textBox4->Name = L"textBox4"; 
       this->textBox4->Size = System::Drawing::Size(100, 20); 
       this->textBox4->TabIndex = 3; 
       // 
       // label1 
       // 
       this->label1->AutoSize = true; 
       this->label1->BackColor = System::Drawing::Color::Transparent; 
       this->label1->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 11.25F, System::Drawing::FontStyle::Bold, System::Drawing::GraphicsUnit::Point, 
        static_cast<System::Byte>(0))); 
       this->label1->ForeColor = System::Drawing::Color::Black; 
       this->label1->Location = System::Drawing::Point(1, 14); 
       this->label1->Name = L"label1"; 
       this->label1->Size = System::Drawing::Size(79, 18); 
       this->label1->TabIndex = 4; 
       this->label1->Text = L"Hypothek"; 
       // 
       // label2 
       // 
       this->label2->AutoSize = true; 
       this->label2->BackColor = System::Drawing::Color::Transparent; 
       this->label2->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 11.25F, System::Drawing::FontStyle::Bold, System::Drawing::GraphicsUnit::Point, 
        static_cast<System::Byte>(0))); 
       this->label2->ForeColor = System::Drawing::Color::Black; 
       this->label2->Location = System::Drawing::Point(1, 40); 
       this->label2->Name = L"label2"; 
       this->label2->Size = System::Drawing::Size(72, 18); 
       this->label2->TabIndex = 5; 
       this->label2->Text = L"Zinssatz"; 
       // 
       // label3 
       // 
       this->label3->AutoSize = true; 
       this->label3->BackColor = System::Drawing::Color::Transparent; 
       this->label3->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 11.25F, System::Drawing::FontStyle::Bold, System::Drawing::GraphicsUnit::Point, 
        static_cast<System::Byte>(0))); 
       this->label3->ForeColor = System::Drawing::Color::Black; 
       this->label3->Location = System::Drawing::Point(1, 66); 
       this->label3->Name = L"label3"; 
       this->label3->Size = System::Drawing::Size(140, 18); 
       this->label3->TabIndex = 6; 
       this->label3->Text = L"Jährliche Zahlung"; 
       // 
       // label4 
       // 
       this->label4->AutoSize = true; 
       this->label4->BackColor = System::Drawing::Color::Transparent; 
       this->label4->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 11.25F, System::Drawing::FontStyle::Bold, System::Drawing::GraphicsUnit::Point, 
        static_cast<System::Byte>(0))); 
       this->label4->ForeColor = System::Drawing::Color::Black; 
       this->label4->Location = System::Drawing::Point(1, 92); 
       this->label4->Name = L"label4"; 
       this->label4->Size = System::Drawing::Size(62, 18); 
       this->label4->TabIndex = 7; 
       this->label4->Text = L"Tilgung"; 
       // 
       // label5 
       // 
       this->label5->AutoSize = true; 
       this->label5->BackColor = System::Drawing::Color::Transparent; 
       this->label5->Font = (gcnew System::Drawing::Font(L"Segoe Script", 24, System::Drawing::FontStyle::Bold, System::Drawing::GraphicsUnit::Point, 
        static_cast<System::Byte>(0))); 
       this->label5->ForeColor = System::Drawing::Color::Black; 
       this->label5->Location = System::Drawing::Point(12, 238); 
       this->label5->Name = L"label5"; 
       this->label5->Size = System::Drawing::Size(256, 53); 
       this->label5->TabIndex = 8; 
       this->label5->Text = L"Tobias Rohde"; 
       // 
       // button1 
       // 
       this->button1->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 14.25F, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point, 
        static_cast<System::Byte>(0))); 
       this->button1->ForeColor = System::Drawing::SystemColors::ControlText; 
       this->button1->Location = System::Drawing::Point(338, 248); 
       this->button1->Name = L"button1"; 
       this->button1->Size = System::Drawing::Size(150, 40); 
       this->button1->TabIndex = 9; 
       this->button1->Text = L"Berechnen"; 
       this->button1->UseVisualStyleBackColor = true; 
       this->button1->Click += gcnew System::EventHandler(this, &Form1::button1_Click); 
       // 
       // textBox5 
       // 
       this->textBox5->Location = System::Drawing::Point(388, 12); 
       this->textBox5->Name = L"textBox5"; 
       this->textBox5->Size = System::Drawing::Size(100, 20); 
       this->textBox5->TabIndex = 10; 
       // 
       // textBox6 
       // 
       this->textBox6->Location = System::Drawing::Point(388, 41); 
       this->textBox6->Name = L"textBox6"; 
       this->textBox6->Size = System::Drawing::Size(100, 20); 
       this->textBox6->TabIndex = 11; 
       // 
       // textBox7 
       // 
       this->textBox7->Location = System::Drawing::Point(388, 67); 
       this->textBox7->Name = L"textBox7"; 
       this->textBox7->Size = System::Drawing::Size(100, 20); 
       this->textBox7->TabIndex = 12; 
       // 
       // textBox8 
       // 
       this->textBox8->Location = System::Drawing::Point(388, 92); 
       this->textBox8->Name = L"textBox8"; 
       this->textBox8->Size = System::Drawing::Size(100, 20); 
       this->textBox8->TabIndex = 13; 
       // 
       // label6 
       // 
       this->label6->AutoSize = true; 
       this->label6->BackColor = System::Drawing::Color::Transparent; 
       this->label6->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 11.25F, System::Drawing::FontStyle::Bold, System::Drawing::GraphicsUnit::Point, 
        static_cast<System::Byte>(0))); 
       this->label6->ForeColor = System::Drawing::Color::Black; 
       this->label6->Location = System::Drawing::Point(282, 14); 
       this->label6->Name = L"label6"; 
       this->label6->Size = System::Drawing::Size(41, 18); 
       this->label6->TabIndex = 14; 
       this->label6->Text = L"Jahr"; 
       // 
       // label7 
       // 
       this->label7->AutoSize = true; 
       this->label7->BackColor = System::Drawing::Color::Transparent; 
       this->label7->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 11.25F, System::Drawing::FontStyle::Bold, System::Drawing::GraphicsUnit::Point, 
        static_cast<System::Byte>(0))); 
       this->label7->ForeColor = System::Drawing::Color::Black; 
       this->label7->Location = System::Drawing::Point(282, 43); 
       this->label7->Name = L"label7"; 
       this->label7->Size = System::Drawing::Size(92, 18); 
       this->label7->TabIndex = 15; 
       this->label7->Text = L"Restschuld"; 
       // 
       // label8 
       // 
       this->label8->AutoSize = true; 
       this->label8->BackColor = System::Drawing::Color::Transparent; 
       this->label8->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 11.25F, System::Drawing::FontStyle::Bold, System::Drawing::GraphicsUnit::Point, 
        static_cast<System::Byte>(0))); 
       this->label8->ForeColor = System::Drawing::Color::Black; 
       this->label8->Location = System::Drawing::Point(282, 69); 
       this->label8->Name = L"label8"; 
       this->label8->Size = System::Drawing::Size(58, 18); 
       this->label8->TabIndex = 16; 
       this->label8->Text = L"Zinsen"; 
       // 
       // label9 
       // 
       this->label9->AutoSize = true; 
       this->label9->BackColor = System::Drawing::Color::Transparent; 
       this->label9->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 11.25F, System::Drawing::FontStyle::Bold, System::Drawing::GraphicsUnit::Point, 
        static_cast<System::Byte>(0))); 
       this->label9->ForeColor = System::Drawing::Color::Black; 
       this->label9->Location = System::Drawing::Point(282, 94); 
       this->label9->Name = L"label9"; 
       this->label9->Size = System::Drawing::Size(62, 18); 
       this->label9->TabIndex = 17; 
       this->label9->Text = L"Tilgung"; 
       // 
       // label10 
       // 
       this->label10->AutoSize = true; 
       this->label10->BackColor = System::Drawing::Color::Transparent; 
       this->label10->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 11.25F, System::Drawing::FontStyle::Bold, System::Drawing::GraphicsUnit::Point, 
        static_cast<System::Byte>(0))); 
       this->label10->ForeColor = System::Drawing::Color::Black; 
       this->label10->Location = System::Drawing::Point(285, 116); 
       this->label10->Name = L"label10"; 
       this->label10->Size = System::Drawing::Size(48, 18); 
       this->label10->TabIndex = 18; 
       this->label10->Text = L"*Jahr"; 
       // 
       // textBox9 
       // 
       this->textBox9->Location = System::Drawing::Point(388, 119); 
       this->textBox9->Name = L"textBox9"; 
       this->textBox9->Size = System::Drawing::Size(41, 20); 
       this->textBox9->TabIndex = 19; 
       // 
       // button2 
       // 
       this->button2->Location = System::Drawing::Point(435, 116); 
       this->button2->Name = L"button2"; 
       this->button2->Size = System::Drawing::Size(53, 23); 
       this->button2->TabIndex = 20; 
       this->button2->Text = L"Calc."; 
       this->button2->UseVisualStyleBackColor = true; 
       this->button2->Click += gcnew System::EventHandler(this, &Form1::button2_Click); 
       // 
       // Form1 
       // 
       this->AutoScaleDimensions = System::Drawing::SizeF(6, 13); 
       this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font; 
       this->BackgroundImage = (cli::safe_cast<System::Drawing::Image^ >(resources->GetObject(L"$this.BackgroundImage"))); 
       this->ClientSize = System::Drawing::Size(500, 300); 
       this->Controls->Add(this->button2); 
       this->Controls->Add(this->textBox9); 
       this->Controls->Add(this->label10); 
       this->Controls->Add(this->label9); 
       this->Controls->Add(this->label8); 
       this->Controls->Add(this->label7); 
       this->Controls->Add(this->label6); 
       this->Controls->Add(this->textBox8); 
       this->Controls->Add(this->textBox7); 
       this->Controls->Add(this->textBox6); 
       this->Controls->Add(this->textBox5); 
       this->Controls->Add(this->button1); 
       this->Controls->Add(this->label5); 
       this->Controls->Add(this->label4); 
       this->Controls->Add(this->label3); 
       this->Controls->Add(this->label2); 
       this->Controls->Add(this->label1); 
       this->Controls->Add(this->textBox4); 
       this->Controls->Add(this->textBox3); 
       this->Controls->Add(this->textBox2); 
       this->Controls->Add(this->textBox1); 
       this->Name = L"Form1"; 
       this->Text = L"Hypotheken Rechner by Tobias Rohde"; 
       this->Load += gcnew System::EventHandler(this, &Form1::Form1_Load); 
       this->ResumeLayout(false); 
       this->PerformLayout(); 

      } 
    #pragma endregion 

     private: System::Void button1_Click(System::Object^ sender, System::EventArgs^ e) { 


      Money=System::Convert::ToInt32(textBox1->Text); 
      Percent=System::Convert::ToInt32(textBox2->Text); 
      tp=System::Convert::ToInt32(textBox3->Text); 
      Redemption=System::Convert::ToInt32(textBox4->Text); 

      for(c=0;c<100;c++){ 
      Money=Money-Redemption; 
      Mone[c]=Money; 
      Interes[c]=Money*Percent/100; 
      Redemption = tp-Interes[c]; //tp to pay 
      Redemptio[c]=Redemption; 
     } 
      for(c=0;c<100;c++){ 
       if(Mone[c]<=0) 
      { 
       textBox5->Text = System::Convert::ToString(Year[c]); 
       textBox6->Text = System::Convert::ToString(Mone[c]); 
       textBox7->Text = System::Convert::ToString(Interes[c]); 
       textBox8->Text = System::Convert::ToString(Redemptio[c]); 
       break; 
      } 
      } 
       } 
    private: System::Void button2_Click(System::Object^ sender, System::EventArgs^ e) { 

       Yeaar=System::Convert::ToInt32(textBox9->Text); 
       c=Yeaar; 

       textBox5->Text = System::Convert::ToString(Year[c]); 
       textBox6->Text = System::Convert::ToString(Mone[c]); 
       textBox7->Text = System::Convert::ToString(Interes[c]); 
       textBox8->Text = System::Convert::ToString(Redemptio[c]); 
      } 
    }; 
    } 

錯誤:

1>------ Build started: Project: Hypotheken Rechner, Configuration: Debug Win32 ------ 
1> Hypotheken Rechner.cpp 
1>c:\users\tobi\documents\visual studio 2010\projects\hypotheken rechner\hypotheken rechner\Form1.h(362): error C2039: 'Form1_Load' : is not a member of 'HypothekenRechner::Form1' 
1>   c:\users\tobi\documents\visual studio 2010\projects\hypotheken rechner\hypotheken rechner\Form1.h(15) : see declaration of 'HypothekenRechner::Form1' 
1>c:\users\tobi\documents\visual studio 2010\projects\hypotheken rechner\hypotheken rechner\Form1.h(362): error C2065: 'Form1_Load' : undeclared identifier 
1>c:\users\tobi\documents\visual studio 2010\projects\hypotheken rechner\hypotheken rechner\Form1.h(362): error C3350: 'System::EventHandler' : a delegate constructor expects 2 argument(s) 
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ========== 

奇怪的是,它指向的是我沒有編輯一條線!

+0

現在一切正常:)剛剛刪除該行,這是一個標籤或文本框的東西!特別感謝user844541! –