Bin gerade dabei einen Rechner zu machen.
Der plus, minus, mal und geteilt kan.
Aber das Problem ist,
error C2061: Syntaxfehler: Bezeichner 'comboBox1'
so sieht der Form1 code aus:
Zitat:
#pragma once
namespace Rechner {
using namespace System;
using namespace System::ComponentModel;
using namespace System::Collections;
using namespace System::Windows::Forms;
using namespace System: ata;
using namespace System: rawing;
/// <summary>
/// Zusammenfassung für Form1
/// </summary>
public ref class Form1 : public System::Windows::Forms::Form
{
public:
Form1(void)
{
InitializeComponent();
//
//TODO: Konstruktorcode hier hinzufügen.
//
}
protected:
/// <summary>
/// Verwendete Ressourcen bereinigen.
/// </summary>
~Form1()
{
if (components)
{
delete components;
}
}
private: System::Windows::Forms::Button^ button1;
protected:
private: System::Windows::Forms: extBox^ textBox1;
private: System::Windows::Forms: extBox^ textBox2;
private: System::Windows::Forms::ComboBox^ comboBox1;
private: System::Windows::Forms: extBox^ textBox3;
private:
/// <summary>
/// Erforderliche Designervariable.
/// </summary>
System::ComponentModel::Container ^components;
#pragma region Windows Form Designer generated code
/// <summary>
/// Erforderliche Methode für die Designerunterstützung.
/// Der Inhalt der Methode darf nicht mit dem Code-Editor geändert werden.
/// </summary>
void InitializeComponent(void)
{
this->button1 = (gcnew System::Windows::Forms::Button());
this->textBox1 = (gcnew System::Windows::Forms: extBox());
this->textBox2 = (gcnew System::Windows::Forms: extBox());
this->comboBox1 = (gcnew System::Windows::Forms::ComboBox());
this->textBox3 = (gcnew System::Windows::Forms: extBox());
this->SuspendLayout();
//
// button1
//
this->button1->Location = System: rawing::Point(361, 53);
this->button1->Name = L"button1";
this->button1->Size = System: rawing::Size(75, 23);
this->button1->TabIndex = 0;
this->button1->Text = L"button1";
this->button1->UseVisualStyleBackColor = true;
this->button1->Click += gcnew System::EventHandler(this, &Form1::button1_Click);
//
// textBox1
//
this->textBox1->Location = System: rawing::Point(22, 55);
this->textBox1->Name = L"textBox1";
this->textBox1->Size = System: rawing::Size(100, 20);
this->textBox1->TabIndex = 1;
//
// textBox2
//
this->textBox2->Location = System: rawing::Point(255, 55);
this->textBox2->Name = L"textBox2";
this->textBox2->Size = System: rawing::Size(100, 20);
this->textBox2->TabIndex = 2;
//
// comboBox1
//
this->comboBox1->FormattingEnabled = true;
this->comboBox1->Items->AddRange(gcnew cli::array< System::Object^ >(4) {L"plus", L"minus", L"mal", L"geteilt druch"});
this->comboBox1->Location = System: rawing::Point(128, 55);
this->comboBox1->Name = L"comboBox1";
this->comboBox1->Size = System: rawing::Size(121, 21);
this->comboBox1->TabIndex = 3;
//
// textBox3
//
this->textBox3->Location = System: rawing::Point(22, 82);
this->textBox3->Name = L"textBox3";
this->textBox3->Size = System: rawing::Size(333, 20);
this->textBox3->TabIndex = 4;
//
// Form1
//
this->AutoScaleDimensions = System: rawing::SizeF(6, 13);
this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
this->ClientSize = System: rawing::Size(457, 261);
this->Controls->Add(this->textBox3);
this->Controls->Add(this->comboBox1);
this->Controls->Add(this->textBox2);
this->Controls->Add(this->textBox1);
this->Controls->Add(this->button1);
this->Name = L"Form1";
this->Text = L"Form1";
this->ResumeLayout(false);
this->PerformLayout();
}
#pragma endregion
private: System::Void button1_Click(System::Object^ sender, System::EventArgs^ e) {
if comboBox1->SelectedItem = comboBox1->Items[0] //addieren
textBox3->Text = System::Convert: oString(System::Convert: oInt32 (textBox1->Text) + System::Convert: oInt32(textBox2->Text));
if comboBox1->SelectedItem = comboBox1->Items[1] //subtrahieren
textBox3->Text = System::Convert: oString(System::Convert: oInt32 (textBox1->Text) - System::Convert: oInt32(textBox2->Text));
if comboBox1->SelectedItem = comboBox1->Items[2] //multipliezieren
textBox3->Text = System::Convert: oString(System::Convert: oInt32 (textBox1->Text) * System::Convert: oInt32(textBox2->Text));
if comboBox1->SelectedItem = comboBox1->Items[3] //dividieren
textBox3->Text = System::Convert: oString(System::Convert: oDoubl e(textBox1->Text) / System::Convert: oDouble(textBox2->Text));
}
};
}
Das Problem beginnt ab:
#pragma endregion
Und wegen diesem Problem will er nicht rechnen.
Ich weiß da leider auch nicht mehr weiter.
Ich danke schon mal im Voraus.
Falls ihr das Projekt braucht um den Fehler zu beheben dan schreibt mir ne nachricht und ich gib euch den download link.