D
Leider funktioniert die zweite Seite vom ersten Thread nicht mehr, deshalb eröffne ich hier einen neuen. Sollte der erste doch funktionieren, hab ich nichts dagegen, wenn ihn die Moderatoren löschen.
In meinem letzten Beitrag hab ich geschrieben, dass es mit dem hier
Form2 *frm2 = new Form2();
frm2->ShowDialog(this);
nicht funktioniert. Er gibt mir immer folgenden Fehler aus.
Kompilieren...
stdafx.cpp
c:\Dokumente und Einstellungen\KingKong3\Desktop\ProjektHotelVL\Hotel\Form1.h(320) : error C2065: 'Form2': nichtdeklarierter Bezeichner
c:\Dokumente und Einstellungen\KingKong3\Desktop\ProjektHotelVL\Hotel\Form1.h(320) : error C2065: 'frm2': nichtdeklarierter Bezeichner
c:\Dokumente und Einstellungen\KingKong3\Desktop\ProjektHotelVL\Hotel\Form1.h(320) : error C2061: Syntaxfehler: Bezeichner 'Form2'
c:\Dokumente und Einstellungen\KingKong3\Desktop\ProjektHotelVL\Hotel\Form1.h(321) : error C2227: Der linke Teil von '->ShowDialog' muss auf Klasse/Struktur/Union zeigen
Typ ist ''unknown-type''
c:\Dokumente und Einstellungen\KingKong3\Desktop\ProjektHotelVL\Hotel\Form1.h(321) : error C3861: 'frm2': Bezeichner wurde auch mit einer argumentbezogenen Suche nicht gefunden
Und mein Quellcode sieht momentan so aus.
#pragma once
namespace Hotel
{
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>
/// Zusammenfassung für Form1
///
/// Achtung: Wenn Sie den Namen dieser Klasse ändern, müssen Sie die Eigenschaft
/// 'Ressourcendateiname' für das Compilertool für verwaltete Ressourcen ändern,
/// das allen .resx-Dateien zugewiesen ist, von denen diese Klasse abhängt.
/// Anderenfalls können die Designer nicht korrekt mit den lokalisierten Ressourcen
/// arbeiten, die diesem Formular zugewiesen sind.
/// </summary>
public __gc class Form1 : public System::Windows::Forms::Form
{
public:
Form1(void)
{
InitializeComponent();
}
protected:
void Dispose(Boolean disposing)
{
if (disposing && components)
{
components->Dispose();
}
__super::Dispose(disposing);
}
private: System::Windows::Forms::Button * button1;
private: System::Windows::Forms::Button * button2;
private: System::Windows::Forms::Button * button3;
private: System::Windows::Forms::Button * button4;
private: System::Windows::Forms::Button * button5;
private: System::Windows::Forms::DateTimePicker * dateTimePicker1;
private: System::Windows::Forms::Label * label2;
private: System::Windows::Forms::Button * button6;
private: System::Windows::Forms::Panel * panel1;
private: System::Windows::Forms::Label * label1;
private: System::Windows::Forms::MainMenu * mainMenu1;
private: System::Windows::Forms::MenuItem * menuItem1;
private: System::Windows::Forms::MenuItem * menuItem2;
private: System::Windows::Forms::MenuItem * menuItem3;
private: System::Windows::Forms::MenuItem * menuItem4;
private: System::Windows::Forms::MenuItem * menuItem5;
private: System::Windows::Forms::MenuItem * menuItem6;
private: System::Windows::Forms::MenuItem * menuItem7;
private: System::Windows::Forms::MenuItem * menuItem8;
private: System::Windows::Forms::TextBox * textBox1;
private: System::Windows::Forms::TextBox * textBox2;
private: System::Windows::Forms::CheckBox * checkBox1;
private: System::Windows::Forms::TextBox * textBox3;
private: System::Windows::Forms::MenuItem * menuItem9;
private:
/// <summary>
/// Erforderliche Designervariable.
/// </summary>
System::ComponentModel::Container * components;
/// <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 = new System::Windows::Forms::Button();
this->button2 = new System::Windows::Forms::Button();
this->button3 = new System::Windows::Forms::Button();
this->button4 = new System::Windows::Forms::Button();
this->button5 = new System::Windows::Forms::Button();
this->dateTimePicker1 = new System::Windows::Forms::DateTimePicker();
this->label2 = new System::Windows::Forms::Label();
this->button6 = new System::Windows::Forms::Button();
this->panel1 = new System::Windows::Forms::Panel();
this->textBox3 = new System::Windows::Forms::TextBox();
this->checkBox1 = new System::Windows::Forms::CheckBox();
this->textBox2 = new System::Windows::Forms::TextBox();
this->textBox1 = new System::Windows::Forms::TextBox();
this->label1 = new System::Windows::Forms::Label();
this->mainMenu1 = new System::Windows::Forms::MainMenu();
this->menuItem1 = new System::Windows::Forms::MenuItem();
this->menuItem8 = new System::Windows::Forms::MenuItem();
this->menuItem9 = new System::Windows::Forms::MenuItem();
this->menuItem2 = new System::Windows::Forms::MenuItem();
this->menuItem3 = new System::Windows::Forms::MenuItem();
this->menuItem4 = new System::Windows::Forms::MenuItem();
this->menuItem5 = new System::Windows::Forms::MenuItem();
this->menuItem6 = new System::Windows::Forms::MenuItem();
this->menuItem7 = new System::Windows::Forms::MenuItem();
this->panel1->SuspendLayout();
this->SuspendLayout();
//
// button1
//
this->button1->Location = System::Drawing::Point(24, 40);
this->button1->Name = S"button1";
this->button1->Size = System::Drawing::Size(88, 23);
this->button1->TabIndex = 0;
this->button1->Text = S"Nachfrage";
this->button1->Click += new System::EventHandler(this, button1_Click);
//
// button2
//
this->button2->Location = System::Drawing::Point(24, 72);
this->button2->Name = S"button2";
this->button2->Size = System::Drawing::Size(88, 23);
this->button2->TabIndex = 1;
this->button2->Text = S"Reservierung";
//
// button3
//
this->button3->Location = System::Drawing::Point(24, 104);
this->button3->Name = S"button3";
this->button3->Size = System::Drawing::Size(88, 23);
this->button3->TabIndex = 2;
this->button3->Text = S"Umsatz";
//
// button4
//
this->button4->Location = System::Drawing::Point(24, 136);
this->button4->Name = S"button4";
this->button4->Size = System::Drawing::Size(88, 23);
this->button4->TabIndex = 3;
this->button4->Text = S"Rechnung";
//
// button5
//
this->button5->Location = System::Drawing::Point(24, 416);
this->button5->Name = S"button5";
this->button5->Size = System::Drawing::Size(88, 23);
this->button5->TabIndex = 4;
this->button5->Text = S"Beenden";
this->button5->Click += new System::EventHandler(this, button5_Click);
this->button5->Enter += new System::EventHandler(this, button5_Click);
//
// dateTimePicker1
//
this->dateTimePicker1->Location = System::Drawing::Point(368, 16);
this->dateTimePicker1->Name = S"dateTimePicker1";
this->dateTimePicker1->TabIndex = 5;
//
// label2
//
this->label2->AllowDrop = true;
this->label2->Font = new System::Drawing::Font(S"Microsoft Sans Serif", 12, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point, (System::Byte)0);
this->label2->Location = System::Drawing::Point(168, 424);
this->label2->Name = S"label2";
this->label2->Size = System::Drawing::Size(560, 23);
this->label2->TabIndex = 7;
this->label2->Text = S"Auslastung";
this->label2->Click += new System::EventHandler(this, label2_Click);
//
// button6
//
this->button6->Location = System::Drawing::Point(24, 168);
this->button6->Name = S"button6";
this->button6->Size = System::Drawing::Size(88, 23);
this->button6->TabIndex = 8;
this->button6->Text = S"Auslastung";
this->button6->Click += new System::EventHandler(this, button6_Click);
//
// panel1
//
this->panel1->Controls->Add(this->textBox3);
this->panel1->Controls->Add(this->checkBox1);
this->panel1->Controls->Add(this->textBox2);
this->panel1->Controls->Add(this->textBox1);
this->panel1->Controls->Add(this->label1);
this->panel1->Controls->Add(this->dateTimePicker1);
this->panel1->Location = System::Drawing::Point(144, 8);
this->panel1->Name = S"panel1";
this->panel1->Size = System::Drawing::Size(584, 360);
this->panel1->TabIndex = 9;
//
// textBox3
//
this->textBox3->Location = System::Drawing::Point(280, 288);
this->textBox3->Name = S"textBox3";
this->textBox3->TabIndex = 4;
this->textBox3->Text = S"Zimmernummer";
//
// checkBox1
//
this->checkBox1->Location = System::Drawing::Point(56, 328);
this->checkBox1->Name = S"checkBox1";
this->checkBox1->Size = System::Drawing::Size(112, 24);
this->checkBox1->TabIndex = 3;
this->checkBox1->Text = S"Kinderzustellbett";
//
// textBox2
//
this->textBox2->Location = System::Drawing::Point(168, 288);
this->textBox2->Name = S"textBox2";
this->textBox2->TabIndex = 2;
this->textBox2->Text = S"Etage";
//
// textBox1
//
this->textBox1->Location = System::Drawing::Point(56, 288);
this->textBox1->Name = S"textBox1";
this->textBox1->TabIndex = 1;
this->textBox1->Text = S"Anzahl der Betten";
//
// label1
//
this->label1->Location = System::Drawing::Point(16, 56);
this->label1->Name = S"label1";
this->label1->Size = System::Drawing::Size(552, 200);
this->label1->TabIndex = 0;
//
// mainMenu1
//
System::Windows::Forms::MenuItem* __mcTemp__1[] = new System::Windows::Forms::MenuItem*[2];
__mcTemp__1[0] = this->menuItem1;
__mcTemp__1[1] = this->menuItem2;
this->mainMenu1->MenuItems->AddRange(__mcTemp__1);
//
// menuItem1
//
this->menuItem1->Index = 0;
System::Windows::Forms::MenuItem* __mcTemp__2[] = new System::Windows::Forms::MenuItem*[2];
__mcTemp__2[0] = this->menuItem8;
__mcTemp__2[1] = this->menuItem9;
this->menuItem1->MenuItems->AddRange(__mcTemp__2);
this->menuItem1->Text = S"Datei";
//
// menuItem8
//
this->menuItem8->Index = 0;
this->menuItem8->Text = S"Beenden";
this->menuItem8->Click += new System::EventHandler(this, menuItem8_Click);
//
// menuItem9
//
this->menuItem9->Index = 1;
this->menuItem9->Text = S"Neue Datenbank erstellen";
this->menuItem9->Click += new System::EventHandler(this, menuItem9_Click);
//
// menuItem2
//
this->menuItem2->Index = 1;
System::Windows::Forms::MenuItem* __mcTemp__3[] = new System::Windows::Forms::MenuItem*[5];
__mcTemp__3[0] = this->menuItem3;
__mcTemp__3[1] = this->menuItem4;
__mcTemp__3[2] = this->menuItem5;
__mcTemp__3[3] = this->menuItem6;
__mcTemp__3[4] = this->menuItem7;
this->menuItem2->MenuItems->AddRange(__mcTemp__3);
this->menuItem2->Text = S"Funktionen";
//
// menuItem3
//
this->menuItem3->Index = 0;
this->menuItem3->Text = S"Nachfrage";
//
// menuItem4
//
this->menuItem4->Index = 1;
this->menuItem4->Text = S"Reservierung";
//
// menuItem5
//
this->menuItem5->Index = 2;
this->menuItem5->Text = S"Umsatz";
//
// menuItem6
//
this->menuItem6->Index = 3;
this->menuItem6->Text = S"Rechnung";
//
// menuItem7
//
this->menuItem7->Index = 4;
this->menuItem7->Text = S"Auslastung";
//
// Form1
//
this->AutoScaleBaseSize = System::Drawing::Size(5, 13);
this->ClientSize = System::Drawing::Size(752, 458);
this->Controls->Add(this->panel1);
this->Controls->Add(this->button6);
this->Controls->Add(this->label2);
this->Controls->Add(this->button5);
this->Controls->Add(this->button4);
this->Controls->Add(this->button3);
this->Controls->Add(this->button2);
this->Controls->Add(this->button1);
this->Menu = this->mainMenu1;
this->Name = S"Form1";
this->Text = S"Projekt Hotel";
this->panel1->ResumeLayout(false);
this->ResumeLayout(false);
}
private: System::Void button5_Click(System::Object * sender, System::EventArgs * e)
{
this->Close();
}
private: System::Void button1_Click(System::Object * sender, System::EventArgs * e)
{
//this->Show()=Form2;
Form2 *frm2 = new Form2();
frm2->ShowDialog(this);
}
private: System::Void label2_Click(System::Object * sender, System::EventArgs * e)
{
label2->Text = ("Hallo Du");
}
private: System::Void menuItem8_Click(System::Object * sender, System::EventArgs * e)
{
this->Close();
}
private: System::Void menuItem9_Click(System::Object * sender, System::EventArgs * e)
{
}
private: System::Void button6_Click(System::Object * sender, System::EventArgs * e)
{
}
};
}
Leider weiß ich im monent leider wirklich nicht ob es an mir liegt, wobei es das eheste sein wird.Vielleicht kann mir auch einer mal ein Projekt mit zwei Formularen ersten bei dem das zweite Formular über einen Button aufgerufen werden kann. Programmieren tu ich wie gesagt mit VS2003.