2013-09-23 4 views
0

Я довольно новичок в C++, и я пишу ипотечный кредитный калькулятор! Вот мой код:Ошибка приложения Windows Forms

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 das Schlüsselwort, используя 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 Изучение C++ в 24 часа um die Основы zu verstehen. ich sagte ja ich bin noch nicht так кишка! –

ответ

0

первый вопрос в том, что, когда вы определили свой класс с реф:

public ref class Form1 

вы сделали свой класс удалось. и строка не управляется. поэтому вы в основном определяете неизмененных членов в управляемом классе, который не разрешен.

+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

все сработало сейчас :) просто удалила эту строку, это было что-то с маской или текстовым полем! Особое спасибо пользователю844541! –

Смежные вопросы