Willkommen
myGully
Links
Forum
08.07.10, 13:56
#1
Erfahrener Newbie
Registriert seit: Jul 2010
Beiträge: 120
Bedankt: 1
Ich habe Form2.Show schon versucht und da hat es nicht geklappt.
Ich benutze Visual Studio 2010 Express.
Form2 habe ich auch eigefügt bei Form1.
Das ist der code für den button:
Zitat:
private: System::Void button3_Click(System::Object^ sender, System::EventArgs^ e) {
Form2.Show
}
};
}
Dan kommen die Fehlermeldungen:
Fehler 1 error C2143: Syntaxfehler: Es fehlt ';' vor '.' Zeile 231
Fehler 2 error C2143: Syntaxfehler: Es fehlt ';' vor '.' Zeile 231
Hier ist noch mal der Code der Form1 Datei:
Zitat:
#pragma once
#include "Form2.h"
namespace Rechner11by*** {
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::ComboBox^ comboBox1;
private: System::Windows::Forms: extBox^ textBox1;
private: System::Windows::Forms: extBox^ textBox2;
private: System::Windows::Forms: extBox^ textBox3;
private: System::Windows::Forms::Label^ label1;
private: System::Windows::Forms::NotifyIcon^ notifyIcon1;
private: System::Windows::Forms::Label^ label2;
private: System::Windows::Forms::Label^ label3;
private: System::Windows::Forms::Button^ button2;
private: System::Windows::Forms::Button^ button3;
private: System::ComponentModel::IContainer^ components;
private:
/// <summary>
/// Erforderliche Designervariable.
/// </summary>
#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->components = (gcnew System::ComponentModel::Container());
System::ComponentModel::ComponentResourceManager^ resources = (gcnew System::ComponentModel::ComponentResourceManager(F orm1::typeid));
this->button1 = (gcnew System::Windows::Forms::Button());
this->comboBox1 = (gcnew System::Windows::Forms::ComboBox());
this->textBox1 = (gcnew System::Windows::Forms: extBox());
this->textBox2 = (gcnew System::Windows::Forms: extBox());
this->textBox3 = (gcnew System::Windows::Forms: extBox());
this->label1 = (gcnew System::Windows::Forms::Label());
this->notifyIcon1 = (gcnew System::Windows::Forms::NotifyIcon(this->components));
this->label2 = (gcnew System::Windows::Forms::Label());
this->label3 = (gcnew System::Windows::Forms::Label());
this->button2 = (gcnew System::Windows::Forms::Button());
this->button3 = (gcnew System::Windows::Forms::Button());
this->SuspendLayout();
//
// button1
//
this->button1->Location = System: rawing::Point(408, 63);
this->button1->Name = L"button1";
this->button1->Size = System: rawing::Size(75, 23);
this->button1->TabIndex = 0;
this->button1->Text = L"Ausrechnen";
this->button1->UseVisualStyleBackColor = true;
this->button1->Click += gcnew System::EventHandler(this, &Form1::button1_Click);
//
// comboBox1
//
this->comboBox1->FormattingEnabled = true;
this->comboBox1->Items->AddRange(gcnew cli::array< System::Object^ >(4) {L"plus", L"minus", L"mal", L"geteilt durch"});
this->comboBox1->Location = System: rawing::Point(175, 65);
this->comboBox1->Name = L"comboBox1";
this->comboBox1->Size = System: rawing::Size(121, 21);
this->comboBox1->TabIndex = 1;
//
// textBox1
//
this->textBox1->Location = System: rawing::Point(69, 66);
this->textBox1->Name = L"textBox1";
this->textBox1->Size = System: rawing::Size(100, 20);
this->textBox1->TabIndex = 2;
//
// textBox2
//
this->textBox2->Location = System: rawing::Point(302, 64);
this->textBox2->Name = L"textBox2";
this->textBox2->Size = System: rawing::Size(100, 20);
this->textBox2->TabIndex = 3;
//
// textBox3
//
this->textBox3->Location = System: rawing::Point(69, 106);
this->textBox3->Name = L"textBox3";
this->textBox3->Size = System: rawing::Size(333, 20);
this->textBox3->TabIndex = 4;
//
// label1
//
this->label1->AutoSize = true;
this->label1->Location = System: rawing::Point(12, 109);
this->label1->Name = L"label1";
this->label1->Size = System: rawing::Size(51, 13);
this->label1->TabIndex = 5;
this->label1->Text = L"Ergebnis:";
//
// notifyIcon1
//
this->notifyIcon1->Icon = (cli::safe_cast<System: rawing::Icon^ >(resources->GetObject(L"notifyIcon1.Icon")));
this->notifyIcon1->Text = L"Taschenrechner 1.1";
this->notifyIcon1->Visible = true;
//
// label2
//
this->label2->AutoSize = true;
this->label2->Location = System: rawing::Point(96, 50);
this->label2->Name = L"label2";
this->label2->Size = System: rawing::Size(37, 13);
this->label2->TabIndex = 6;
this->label2->Text = L"Zahl 1";
//
// label3
//
this->label3->AutoSize = true;
this->label3->Location = System: rawing::Point(332, 50);
this->label3->Name = L"label3";
this->label3->Size = System: rawing::Size(37, 13);
this->label3->TabIndex = 7;
this->label3->Text = L"Zahl 2";
//
// button2
//
this->button2->Location = System: rawing::Point(302, 176);
this->button2->Name = L"button2";
this->button2->Size = System: rawing::Size(75, 23);
this->button2->TabIndex = 8;
this->button2->Text = L"Schließen";
this->button2->UseVisualStyleBackColor = true;
this->button2->Click += gcnew System::EventHandler(this, &Form1::button2_Click);
//
// button3
//
this->button3->Location = System: rawing::Point(94, 176);
this->button3->Name = L"button3";
this->button3->Size = System: rawing::Size(75, 23);
this->button3->TabIndex = 9;
this->button3->Text = L"Info";
this->button3->UseVisualStyleBackColor = true;
this->button3->Click += gcnew System::EventHandler(this, &Form1::button3_Click);
//
// Form1
//
this->AutoScaleDimensions = System: rawing::SizeF(6, 13);
this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
this->ClientSize = System: rawing::Size(502, 224);
this->Controls->Add(this->button3);
this->Controls->Add(this->button2);
this->Controls->Add(this->label3);
this->Controls->Add(this->label2);
this->Controls->Add(this->label1);
this->Controls->Add(this->textBox3);
this->Controls->Add(this->textBox2);
this->Controls->Add(this->textBox1);
this->Controls->Add(this->comboBox1);
this->Controls->Add(this->button1);
this->Cursor = System::Windows::Forms::Cursors::Arrow;
this->Icon = (cli::safe_cast<System: rawing::Icon^ >(resources->GetObject(L"$this.Icon")));
this->Name = L"Form1";
this->Text = L"Taschenrechner 1.1";
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));
}
private: System::Void button2_Click(System::Object^ sender, System::EventArgs^ e) {
this->Close();
}
private: System::Void button3_Click(System::Object^ sender, System::EventArgs^ e) {
Form2.Show
}
};
}
08.07.10, 14:47
#2
Registriert seit: Dec 2009
Beiträge: 792
Bedankt: 49
Zitat:
Zitat von
moin2010
Dan kommen die Fehlermeldungen:
Fehler 1 error C2143: Syntaxfehler: Es fehlt ';' vor '.' Zeile 231
Fehler 2 error C2143: Syntaxfehler: Es fehlt ';' vor '.' Zeile 231
Liest du dir eigentlich die Fehlermeldungen durch? Da steht doch dass da ein ";" fehlt.
Außerdem weiß ich immer noch nicht welche Sprache du benutzt..C++? Hab leider nur Basic, aber kannst ja mal versuchen
zu machen..ich würd an deiner Stelle auch lieber erstmal mit Visual Basic anfangen ist viel leichter..
__________________
To succeed you have to stop being ordinary and be legen - wait for it - dary.
08.07.10, 14:50
#3
Erfahrener Newbie
Registriert seit: Jul 2010
Beiträge: 120
Bedankt: 1
Form2.Show; habe ich ja auch schon probiert.
Ok.
Ich probiere dan mal Visual Basic aus.
Und die Fehlermeldungen lese ich mir natürlich auch durch.
Sry.
Ich benutze Visual C++ 2010 Express.
Geht das auch?
Forumregeln
Du kannst keine neue Themen eröffnen
Du kannst keine Antworten verfassen
Du kannst keine Anhänge posten
Du kannst nicht deine Beiträge editieren
HTML-Code ist Aus .
Alle Zeitangaben in WEZ +1. Es ist jetzt 22:31 Uhr.
().