fatal error C1075: Dateiende erreicht...



  • In meinem Code kommt wenn ich in debugge folgende meldung:
    .\AD.cpp(30) : fatal error C1075: Dateiende erreicht, bevor das zugehörige Element für das linke Element Klammer "{" in "c:\dokumente und einstellungen\\desktop\\\\Registration.h(27)" gefunden wurde

    AD.cpp:

    #include "stdafx.h"
    #include "Anmeldung.h"
    #include "Registration.h"
    
    [STAThreadAttribute]
    int main(array<System::String ^> ^args)
    	{
    		Application::EnableVisualStyles();
    		Application::SetCompatibleTextRenderingDefault(false);
    
    		int w = 1;
    		if (w == 1)
    		{
    			Application::Run(gcnew Registration());
    			return 0;
    		}
    		else
    		{
    			Application::Run(gcnew Anmeldung());
    			return 0;
    		}
    	}
    

    und Regestration.h:

    #pragma once
    #include "stdafx.h"
    #include <string>
    
    using namespace System;
    using namespace System::ComponentModel;
    using namespace System::Collections;
    using namespace System::Windows::Forms;
    using namespace System::Text;
    using namespace System::Drawing;
    using namespace System::Data;
    using namespace System::IO;
    
    namespace * {
    
    	/// <summary>
    	/// Zusammenfassung für Registration
    	///
    	/// Warnung: Wenn Sie den Namen dieser Klasse ändern, müssen Sie auch
    	///          die Ressourcendateiname-Eigenschaft für das Tool zur Kompilierung verwalteter 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 ref class Registration : public System::Windows::Forms::Form
    	{
    	public:
    		Registration(void)
    		{
    			InitializeComponent();
    			//
    			//TODO: Konstruktorcode hier hinzufügen.
    			//
    		}
    
    	protected:
    		/// <summary>
    		/// Verwendete Ressourcen bereinigen.
    		/// </summary>
    		~Registration()
    		{
    			if (components)
    			{
    				delete components;
    			}
    		}
       private: System::Windows::Forms::TextBox^  textBox1;
       protected: 
       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::Button^  btn_Registrieren;
       private: System::Windows::Forms::TextBox^  tb_Kennwort;
       private: System::Windows::Forms::TextBox^  tb_Name;
       private: System::Windows::Forms::TextBox^  tb_Frage;
       private: System::Windows::Forms::TextBox^  tb_Antwort;
    
    	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)
    		{
    			System::ComponentModel::ComponentResourceManager^  resources = (gcnew System::ComponentModel::ComponentResourceManager(Registration::typeid));
    			this->textBox1 = (gcnew System::Windows::Forms::TextBox());
    			this->label1 = (gcnew System::Windows::Forms::Label());
    			this->btn_Registrieren = (gcnew System::Windows::Forms::Button());
    			this->tb_Kennwort = (gcnew System::Windows::Forms::TextBox());
    			this->tb_Name = (gcnew System::Windows::Forms::TextBox());
    			this->label2 = (gcnew System::Windows::Forms::Label());
    			this->tb_Frage = (gcnew System::Windows::Forms::TextBox());
    			this->tb_Antwort = (gcnew System::Windows::Forms::TextBox());
    			this->label4 = (gcnew System::Windows::Forms::Label());
    			this->label3 = (gcnew System::Windows::Forms::Label());
    			this->SuspendLayout();
    			// 
    			// textBox1
    			// 
    			this->textBox1->AccessibleDescription = nullptr;
    			this->textBox1->AccessibleName = nullptr;
    			resources->ApplyResources(this->textBox1, L"textBox1");
    			this->textBox1->BackgroundImage = nullptr;
    			this->textBox1->Name = L"textBox1";
    			this->textBox1->ReadOnly = true;
    			this->textBox1->TabStop = false;
    			// 
    			// label1
    			// 
    			this->label1->AccessibleDescription = nullptr;
    			this->label1->AccessibleName = nullptr;
    			resources->ApplyResources(this->label1, L"label1");
    			this->label1->Name = L"label1";
    			// 
    			// btn_Registrieren
    			// 
    			this->btn_Registrieren->AccessibleDescription = nullptr;
    			this->btn_Registrieren->AccessibleName = nullptr;
    			resources->ApplyResources(this->btn_Registrieren, L"btn_Registrieren");
    			this->btn_Registrieren->BackgroundImage = nullptr;
    			this->btn_Registrieren->Cursor = System::Windows::Forms::Cursors::Hand;
    			this->btn_Registrieren->Name = L"btn_Registrieren";
    			this->btn_Registrieren->UseVisualStyleBackColor = true;
    			this->btn_Registrieren->Click += gcnew System::EventHandler(this, &Registration::btn_Registrieren_Click);
    			// 
    			// tb_Kennwort
    			// 
    			this->tb_Kennwort->AccessibleDescription = nullptr;
    			this->tb_Kennwort->AccessibleName = nullptr;
    			resources->ApplyResources(this->tb_Kennwort, L"tb_Kennwort");
    			this->tb_Kennwort->BackgroundImage = nullptr;
    			this->tb_Kennwort->Font = nullptr;
    			this->tb_Kennwort->Name = L"tb_Kennwort";
    			this->tb_Kennwort->UseSystemPasswordChar = true;
    			// 
    			// tb_Name
    			// 
    			this->tb_Name->AccessibleDescription = nullptr;
    			this->tb_Name->AccessibleName = nullptr;
    			resources->ApplyResources(this->tb_Name, L"tb_Name");
    			this->tb_Name->BackgroundImage = nullptr;
    			this->tb_Name->Font = nullptr;
    			this->tb_Name->Name = L"tb_Name";
    			this->tb_Name->TextChanged += gcnew System::EventHandler(this, &Registration::tb_Name_TextChanged);
    			// 
    			// label2
    			// 
    			this->label2->AccessibleDescription = nullptr;
    			this->label2->AccessibleName = nullptr;
    			resources->ApplyResources(this->label2, L"label2");
    			this->label2->Name = L"label2";
    			// 
    			// tb_Frage
    			// 
    			this->tb_Frage->AccessibleDescription = nullptr;
    			this->tb_Frage->AccessibleName = nullptr;
    			resources->ApplyResources(this->tb_Frage, L"tb_Frage");
    			this->tb_Frage->BackgroundImage = nullptr;
    			this->tb_Frage->Font = nullptr;
    			this->tb_Frage->Name = L"tb_Frage";
    			// 
    			// tb_Antwort
    			// 
    			this->tb_Antwort->AccessibleDescription = nullptr;
    			this->tb_Antwort->AccessibleName = nullptr;
    			resources->ApplyResources(this->tb_Antwort, L"tb_Antwort");
    			this->tb_Antwort->BackgroundImage = nullptr;
    			this->tb_Antwort->Font = nullptr;
    			this->tb_Antwort->Name = L"tb_Antwort";
    			// 
    			// label4
    			// 
    			this->label4->AccessibleDescription = nullptr;
    			this->label4->AccessibleName = nullptr;
    			resources->ApplyResources(this->label4, L"label4");
    			this->label4->Name = L"label4";
    			// 
    			// label3
    			// 
    			this->label3->AccessibleDescription = nullptr;
    			this->label3->AccessibleName = nullptr;
    			resources->ApplyResources(this->label3, L"label3");
    			this->label3->Name = L"label3";
    			// 
    			// Registration
    			// 
    			this->AccessibleDescription = nullptr;
    			this->AccessibleName = nullptr;
    			resources->ApplyResources(this, L"$this");
    			this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
    			this->BackgroundImage = nullptr;
    			this->Controls->Add(this->label1);
    			this->Controls->Add(this->label2);
    			this->Controls->Add(this->label3);
    			this->Controls->Add(this->label4);
    			this->Controls->Add(this->tb_Name);
    			this->Controls->Add(this->tb_Kennwort);
    			this->Controls->Add(this->btn_Registrieren);
    			this->Controls->Add(this->tb_Frage);
    			this->Controls->Add(this->tb_Antwort);
    			this->Controls->Add(this->textBox1);
    			this->Font = nullptr;
    			this->FormBorderStyle = System::Windows::Forms::FormBorderStyle::FixedSingle;
    			this->HelpButton = true;
    			this->MaximizeBox = false;
    			this->MinimizeBox = false;
    			this->Name = L"Registration";
    			this->ResumeLayout(false);
    			this->PerformLayout();
    
    		}
    #pragma endregion
       private: 
    
          void btn_Registrieren_Click(Object^  sender, EventArgs^  e) 
    	  {
             if (tb_Name->Text == "" || tb_Kennwort->Text == "")
    		 {
                MessageBox::Show("Name und/oder Passwort sind ungültig!", "Fehler");
             }
    		 else if (tb_Frage->Text == "" || tb_Antwort->Text == "")
    		 {
                StringBuilder ^str = gcnew StringBuilder("");
                str->Append("\n Frage und/oder Antwort sind ungültig!");
                str->Append("\n Weitere Informationen dazu finden sie unter Hilfe");
                MessageBox::Show(str->ToString(), "Fehler");
                //hilfe kommt noch...
    		 }
    		 else
    		 {
    			 main(array<System::String ^> ^args)
    			 {
    				FileStream ^fs = nullptr;
    				StreamWriter ^sw = nullptr;
    
    				string ^Daten;
    				Daten = tb_Name + ".pzt";
    
    				try
       {
          fs = gcnew FileStream(Daten, FileMode::Append);
          sw = gcnew StreamWriter(fs); 
    
          sw->WriteLine ("{0},{1},{2},{3}", tb_Name, tb_Kennwort, 
                                                tb_Frage,tb_Antwort);
       }
       catch (Exception ^e)
       {
    	   MessageBox::Show("Accountname exestiert bereits!", "Fehler");
       }
       finally
       {
          if (sw)
             sw->Close();
       }
      }
    };
    }
    

    ich hoffe ihr könnt mir helfen das problem zu lösen

    lg
    LehrLehrling

    ^PS: *=Zensur aus Sicherheitsgründen^ 🕶



  • Am Ende stimmen die schließenden Klammern überhaupt nicht mehr. Aber ist das nen Copy n' Paste Fehler oder was soll das main in deinem Button Click Eventhandler?



  • Problem gelöst klammern waren anderes prob:
    1>c:\dokumente und einstellungen\\desktop\\\\Registration.h(223) : error C2248: "System::Windows::Forms::Control::text": Kein Zugriff auf private Member, dessen Deklaration in der System::Windows::Forms::Control-Klasse erfolgte.
    1> c:\dokumente und einstellungen\\desktop\\\\Anmeldung.h(28): Siehe Deklaration von 'System::Windows::Forms::Control::text'
    1> c:\windows\microsoft.net\framework\v2.0.50727\system.windows.forms.dll: Siehe Deklaration von 'System::Windows::Forms::Control'
    Anmeldung.h:

    #pragma once
    #include "stdafx.h"
    #include <string>
    
    using namespace System;
    using namespace System::ComponentModel;
    using namespace System::Collections;
    using namespace System::Windows::Forms;
    using namespace System::Text;
    using namespace System::Drawing;
    using namespace System::Data;
    using namespace System::Media;
    using namespace System::IO;
    
    namespace * {
    
    	/// <summary>
    	/// Zusammenfassung für Anmeldung
    	///
    	/// Warnung: Wenn Sie den Namen dieser Klasse ändern, müssen Sie auch
    	///          die Ressourcendateiname-Eigenschaft für das Tool zur Kompilierung verwalteter 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 ref class Anmeldung : public System::Windows::Forms::Form
    	{
    	public:
    		Anmeldung(void)
    		{
    			InitializeComponent();
    			//
    			//TODO: Konstruktorcode hier hinzufügen.
    			//
    		}
    
    	protected:
    		/// <summary>
    		/// Verwendete Ressourcen bereinigen.
    		/// </summary>
    		~Anmeldung()
    		{
    			if (components)
    			{
    				delete components;
    			}
    		}
       private: System::Windows::Forms::TextBox^  textBox1;
       protected: 
       private: System::Windows::Forms::Label^  label2;
       private: System::Windows::Forms::Label^  label1;
       private: System::Windows::Forms::Button^  btn_Anmelden;
       private: System::Windows::Forms::TextBox^  tb_Kennwort;
       private: System::Windows::Forms::TextBox^  tb_Name;
    
    	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)
    		{
    			System::ComponentModel::ComponentResourceManager^  resources = (gcnew System::ComponentModel::ComponentResourceManager(Anmeldung::typeid));
    			this->textBox1 = (gcnew System::Windows::Forms::TextBox());
    			this->btn_Anmelden = (gcnew System::Windows::Forms::Button());
    			this->tb_Kennwort = (gcnew System::Windows::Forms::TextBox());
    			this->tb_Name = (gcnew System::Windows::Forms::TextBox());
    			this->label2 = (gcnew System::Windows::Forms::Label());
    			this->label1 = (gcnew System::Windows::Forms::Label());
    			this->SuspendLayout();
    			// 
    			// textBox1
    			// 
    			this->textBox1->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 9.75F, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point, 
    				static_cast<System::Byte>(0)));
    			this->textBox1->Location = System::Drawing::Point(2, 3);
    			this->textBox1->Multiline = true;
    			this->textBox1->Name = L"textBox1";
    			this->textBox1->ReadOnly = true;
    			this->textBox1->Size = System::Drawing::Size(380, 41);
    			this->textBox1->TabIndex = 1;
    			this->textBox1->TabStop = false;
    			this->textBox1->Text = L"Bitte geben sie ihr Benutztername und ihr Passwort ein, um sich anzumelden.";
    			// 
    			// btn_Anmelden
    			// 
    			this->btn_Anmelden->Location = System::Drawing::Point(127, 113);
    			this->btn_Anmelden->Name = L"btn_Anmelden";
    			this->btn_Anmelden->Size = System::Drawing::Size(200, 23);
    			this->btn_Anmelden->TabIndex = 0;
    			this->btn_Anmelden->Text = L"Anmelden";
    			this->btn_Anmelden->UseVisualStyleBackColor = true;
    			this->btn_Anmelden->Click += gcnew System::EventHandler(this, &Anmeldung::btn_Anmelden_Click);
    			// 
    			// tb_Kennwort
    			// 
    			this->tb_Kennwort->Location = System::Drawing::Point(127, 61);
    			this->tb_Kennwort->Name = L"tb_Kennwort";
    			this->tb_Kennwort->PasswordChar = '*';
    			this->tb_Kennwort->Size = System::Drawing::Size(200, 20);
    			this->tb_Kennwort->TabIndex = 1;
    			// 
    			// tb_Name
    			// 
    			this->tb_Name->Location = System::Drawing::Point(127, 87);
    			this->tb_Name->Name = L"tb_Name";
    			this->tb_Name->Size = System::Drawing::Size(200, 20);
    			this->tb_Name->TabIndex = 2;
    			// 
    			// label2
    			// 
    			this->label2->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 11.25F, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point, 
    				static_cast<System::Byte>(0)));
    			this->label2->Location = System::Drawing::Point(45, 86);
    			this->label2->Name = L"label2";
    			this->label2->Size = System::Drawing::Size(76, 23);
    			this->label2->TabIndex = 3;
    			this->label2->Text = L"Passwort:";
    			// 
    			// label1
    			// 
    			this->label1->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 11.25F, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point, 
    				static_cast<System::Byte>(0)));
    			this->label1->Location = System::Drawing::Point(12, 60);
    			this->label1->Name = L"label1";
    			this->label1->Size = System::Drawing::Size(109, 23);
    			this->label1->TabIndex = 4;
    			this->label1->Text = L"Benutzername:";
    			// 
    			// Anmeldung
    			// 
    			this->AutoScaleDimensions = System::Drawing::SizeF(6, 13);
    			this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
    			this->ClientSize = System::Drawing::Size(385, 154);
    			this->Controls->Add(this->tb_Name);
    			this->Controls->Add(this->tb_Kennwort);
    			this->Controls->Add(this->label2);
    			this->Controls->Add(this->label1);
    			this->Controls->Add(this->btn_Anmelden);
    			this->Controls->Add(this->textBox1);
    			this->FormBorderStyle = System::Windows::Forms::FormBorderStyle::FixedSingle;
    			this->Icon = (cli::safe_cast<System::Drawing::Icon^  >(resources->GetObject(L"$this.Icon")));
    			this->MaximizeBox = false;
    			this->MinimizeBox = false;
    			this->Name = L"Anmeldung";
    			this->Text = L"Anmelden";
    			this->ResumeLayout(false);
    			this->PerformLayout();
    
    		}
    #pragma endregion
       private: 
          void btn_Anmelden_Click(Object^  sender, EventArgs^  e) 
          {
             if (tb_Name->Text == "" || tb_Kennwort->Text == "")
             {
                MessageBox::Show("Falscher Benutzername oder falsches Passwort Keine Eingabe", "Fehler");
             }
             else
             {
                //Schwachsinn :arrow_right: 
                StringBuilder ^str = gcnew StringBuilder("");
                str->Append(" Sie wurden ausspioniert. \n");
                str->Append("\n  Ihr Benutzername ist " + tb_Name->Text);
                str->Append("\n  Ihr Kennwort lautet  " + tb_Kennwort->Text);
    
                MessageBox::Show(str->ToString(), "Pech gehabt!");
             }
          }
    };
    }
    

    und Registration.h:

    #pragma once
    #include "stdafx.h"
    #include <string>
    
    using namespace System;
    using namespace System::ComponentModel;
    using namespace System::Collections;
    using namespace System::Windows::Forms;
    using namespace System::Text;
    using namespace System::Drawing;
    using namespace System::Data;
    using namespace System::Media;
    using namespace System::IO;
    
    namespace julian {
    
    	/// <summary>
    	/// Zusammenfassung für Registration
    	///
    	/// Warnung: Wenn Sie den Namen dieser Klasse ändern, müssen Sie auch
    	///          die Ressourcendateiname-Eigenschaft für das Tool zur Kompilierung verwalteter 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 ref class Registration : public System::Windows::Forms::Form
    	{
    	public:
    		Registration(void)
    		{
    			InitializeComponent();
    			//
    			//TODO: Konstruktorcode hier hinzufügen.
    			//
    		}
    
    	protected:
    		/// <summary>
    		/// Verwendete Ressourcen bereinigen.
    		/// </summary>
    		~Registration()
    		{
    			if (components)
    			{
    				delete components;
    			}
    		}
       private: System::Windows::Forms::TextBox^  textBox1;
       protected: 
       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::Button^  btn_Registrieren;
       private: System::Windows::Forms::TextBox^  tb_Kennwort;
       private: System::Windows::Forms::TextBox^  tb_Name;
       private: System::Windows::Forms::TextBox^  tb_Frage;
       private: System::Windows::Forms::TextBox^  tb_Antwort;
    
    	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)
    		{
    			System::ComponentModel::ComponentResourceManager^  resources = (gcnew System::ComponentModel::ComponentResourceManager(Registration::typeid));
    			this->textBox1 = (gcnew System::Windows::Forms::TextBox());
    			this->label1 = (gcnew System::Windows::Forms::Label());
    			this->btn_Registrieren = (gcnew System::Windows::Forms::Button());
    			this->tb_Kennwort = (gcnew System::Windows::Forms::TextBox());
    			this->tb_Name = (gcnew System::Windows::Forms::TextBox());
    			this->label2 = (gcnew System::Windows::Forms::Label());
    			this->tb_Frage = (gcnew System::Windows::Forms::TextBox());
    			this->tb_Antwort = (gcnew System::Windows::Forms::TextBox());
    			this->label4 = (gcnew System::Windows::Forms::Label());
    			this->label3 = (gcnew System::Windows::Forms::Label());
    			this->SuspendLayout();
    			// 
    			// textBox1
    			// 
    			this->textBox1->AccessibleDescription = nullptr;
    			this->textBox1->AccessibleName = nullptr;
    			resources->ApplyResources(this->textBox1, L"textBox1");
    			this->textBox1->BackgroundImage = nullptr;
    			this->textBox1->Name = L"textBox1";
    			this->textBox1->ReadOnly = true;
    			this->textBox1->TabStop = false;
    			// 
    			// label1
    			// 
    			this->label1->AccessibleDescription = nullptr;
    			this->label1->AccessibleName = nullptr;
    			resources->ApplyResources(this->label1, L"label1");
    			this->label1->Name = L"label1";
    			// 
    			// btn_Registrieren
    			// 
    			this->btn_Registrieren->AccessibleDescription = nullptr;
    			this->btn_Registrieren->AccessibleName = nullptr;
    			resources->ApplyResources(this->btn_Registrieren, L"btn_Registrieren");
    			this->btn_Registrieren->BackgroundImage = nullptr;
    			this->btn_Registrieren->Cursor = System::Windows::Forms::Cursors::Hand;
    			this->btn_Registrieren->Name = L"btn_Registrieren";
    			this->btn_Registrieren->UseVisualStyleBackColor = true;
    			this->btn_Registrieren->Click += gcnew System::EventHandler(this, &Registration::btn_Registrieren_Click);
    			// 
    			// tb_Kennwort
    			// 
    			this->tb_Kennwort->AccessibleDescription = nullptr;
    			this->tb_Kennwort->AccessibleName = nullptr;
    			resources->ApplyResources(this->tb_Kennwort, L"tb_Kennwort");
    			this->tb_Kennwort->BackgroundImage = nullptr;
    			this->tb_Kennwort->Font = nullptr;
    			this->tb_Kennwort->Name = L"tb_Kennwort";
    			this->tb_Kennwort->UseSystemPasswordChar = true;
    			// 
    			// tb_Name
    			// 
    			this->tb_Name->AccessibleDescription = nullptr;
    			this->tb_Name->AccessibleName = nullptr;
    			resources->ApplyResources(this->tb_Name, L"tb_Name");
    			this->tb_Name->BackgroundImage = nullptr;
    			this->tb_Name->Font = nullptr;
    			this->tb_Name->Name = L"tb_Name";
    			// 
    			// label2
    			// 
    			this->label2->AccessibleDescription = nullptr;
    			this->label2->AccessibleName = nullptr;
    			resources->ApplyResources(this->label2, L"label2");
    			this->label2->Name = L"label2";
    			// 
    			// tb_Frage
    			// 
    			this->tb_Frage->AccessibleDescription = nullptr;
    			this->tb_Frage->AccessibleName = nullptr;
    			resources->ApplyResources(this->tb_Frage, L"tb_Frage");
    			this->tb_Frage->BackgroundImage = nullptr;
    			this->tb_Frage->Font = nullptr;
    			this->tb_Frage->Name = L"tb_Frage";
    			// 
    			// tb_Antwort
    			// 
    			this->tb_Antwort->AccessibleDescription = nullptr;
    			this->tb_Antwort->AccessibleName = nullptr;
    			resources->ApplyResources(this->tb_Antwort, L"tb_Antwort");
    			this->tb_Antwort->BackgroundImage = nullptr;
    			this->tb_Antwort->Font = nullptr;
    			this->tb_Antwort->Name = L"tb_Antwort";
    			// 
    			// label4
    			// 
    			this->label4->AccessibleDescription = nullptr;
    			this->label4->AccessibleName = nullptr;
    			resources->ApplyResources(this->label4, L"label4");
    			this->label4->Name = L"label4";
    			// 
    			// label3
    			// 
    			this->label3->AccessibleDescription = nullptr;
    			this->label3->AccessibleName = nullptr;
    			resources->ApplyResources(this->label3, L"label3");
    			this->label3->Name = L"label3";
    			// 
    			// Registration
    			// 
    			this->AccessibleDescription = nullptr;
    			this->AccessibleName = nullptr;
    			resources->ApplyResources(this, L"$this");
    			this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
    			this->BackgroundImage = nullptr;
    			this->Controls->Add(this->label1);
    			this->Controls->Add(this->label2);
    			this->Controls->Add(this->label3);
    			this->Controls->Add(this->label4);
    			this->Controls->Add(this->tb_Name);
    			this->Controls->Add(this->tb_Kennwort);
    			this->Controls->Add(this->btn_Registrieren);
    			this->Controls->Add(this->tb_Frage);
    			this->Controls->Add(this->tb_Antwort);
    			this->Controls->Add(this->textBox1);
    			this->Font = nullptr;
    			this->FormBorderStyle = System::Windows::Forms::FormBorderStyle::FixedSingle;
    			this->HelpButton = true;
    			this->MaximizeBox = false;
    			this->MinimizeBox = false;
    			this->Name = L"Registration";
    			this->ResumeLayout(false);
    			this->PerformLayout();
    
    		}
    #pragma endregion
       private: 
    
          void btn_Registrieren_Click(Object^  sender, EventArgs^  e) 
    	  {
             if (tb_Name->Text == "" || tb_Kennwort->Text == "")
    		 {
                MessageBox::Show("Name und/oder Passwort sind ungültig!", "Fehler");
             }
    		 else if (tb_Frage->Text == "" || tb_Antwort->Text == "")
    		 {
                StringBuilder ^str = gcnew StringBuilder("");
                str->Append("\n Frage und/oder Antwort sind ungültig!");
                str->Append("\n Weitere Informationen dazu finden sie unter Hilfe");
                MessageBox::Show(str->ToString(), "Fehler");
    		 }
    		 else
    		 {
    
    			 {
    				FileStream ^fs = nullptr;
    				StreamWriter ^sw = nullptr;
    
    				String ^Daten;
    				Daten += tb_Name->text + ".*";
    
    				try
       {
          fs = gcnew FileStream(Daten, FileMode::Append);
          sw = gcnew StreamWriter(fs); 
    
          sw->WriteLine ("{0},{1},{2},{3}", tb_Name, tb_Kennwort, 
                                                tb_Frage,tb_Antwort);
       }
       catch (Exception ^e)
       {
    	   MessageBox::Show("Accountname exestiert bereits!", "Fehler");
       }
       finally
       {
          if (sw)
             sw->Close();
       }
      }
     }
    }
    };
    }
    

    ich hoffe ihr könnt helfen!?
    lg 🤡



  • ich hab den fehler "text" -muss> "Text" heißen...
    lg



  • Poste bitte nur den Relevanten Quellcode! Wenn Du nicht weißt welcher Teil relevant ist noch mal ins Grundlagenbuch schauen bevor das ganze Progjekt gepostet wird.

    Danke!



  • Für mich ist das der relevante Code.
    Wenn Dir das nicht passt, und Tschüß...


Anmelden zum Antworten