#pragma once


namespace ErrorProvider1 {

	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
	///
	/// 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 Form1 : public System::Windows::Forms::Form
	{
   private:
      ErrorProvider ^errprov;

	public:
		Form1(void)
		{
			InitializeComponent();
			
         errprov = gcnew ErrorProvider();
		}

	protected:
		/// <summary>
		/// Verwendete Ressourcen bereinigen.
		/// </summary>
		~Form1()
		{
			if (components)
			{
				delete components;
			}
		}
   private: System::Windows::Forms::Label^  label1;
   protected: 
   private: System::Windows::Forms::Button^  button1;
   private: System::Windows::Forms::TextBox^  textBox1;
   private: System::Windows::Forms::Label^  label2;
   private: System::Windows::Forms::TextBox^  textBox2;

	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->label1 = (gcnew System::Windows::Forms::Label());
         this->button1 = (gcnew System::Windows::Forms::Button());
         this->textBox1 = (gcnew System::Windows::Forms::TextBox());
         this->label2 = (gcnew System::Windows::Forms::Label());
         this->textBox2 = (gcnew System::Windows::Forms::TextBox());
         this->SuspendLayout();
         // 
         // label1
         // 
         this->label1->AutoSize = true;
         this->label1->Location = System::Drawing::Point(33, 59);
         this->label1->Name = L"label1";
         this->label1->Size = System::Drawing::Size(108, 13);
         this->label1->TabIndex = 0;
         this->label1->Text = L"Vor- und Nachname :";
         // 
         // button1
         // 
         this->button1->Enabled = false;
         this->button1->Location = System::Drawing::Point(323, 191);
         this->button1->Name = L"button1";
         this->button1->Size = System::Drawing::Size(75, 23);
         this->button1->TabIndex = 1;
         this->button1->Text = L"Weiter";
         this->button1->UseVisualStyleBackColor = true;
         this->button1->Click += gcnew System::EventHandler(this, &Form1::button1_Click);
         // 
         // textBox1
         // 
         this->textBox1->Location = System::Drawing::Point(147, 52);
         this->textBox1->Name = L"textBox1";
         this->textBox1->Size = System::Drawing::Size(238, 20);
         this->textBox1->TabIndex = 2;
         this->textBox1->Validating += gcnew System::ComponentModel::CancelEventHandler(this, &Form1::textBox1_Validating);
         // 
         // label2
         // 
         this->label2->AutoSize = true;
         this->label2->Location = System::Drawing::Point(28, 105);
         this->label2->Name = L"label2";
         this->label2->Size = System::Drawing::Size(113, 13);
         this->label2->TabIndex = 3;
         this->label2->Text = L"optionaler Codename :";
         // 
         // textBox2
         // 
         this->textBox2->Location = System::Drawing::Point(147, 102);
         this->textBox2->Name = L"textBox2";
         this->textBox2->Size = System::Drawing::Size(238, 20);
         this->textBox2->TabIndex = 4;
         // 
         // Form1
         // 
         this->AutoScaleDimensions = System::Drawing::SizeF(6, 13);
         this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
         this->ClientSize = System::Drawing::Size(428, 226);
         this->Controls->Add(this->textBox2);
         this->Controls->Add(this->label2);
         this->Controls->Add(this->textBox1);
         this->Controls->Add(this->button1);
         this->Controls->Add(this->label1);
         this->Name = L"Form1";
         this->Text = L"Benutzereingaben auswerten";
         this->ResumeLayout(false);
         this->PerformLayout();

      }
#pragma endregion
   private: 
      void textBox1_Validating(Object^  sender, CancelEventArgs^  e) 
      {
         // ...

         // alte Meldungen löschen
         errprov->Clear();

         // positionieren
         errprov->SetIconPadding(textBox1,5);
         errprov->SetIconAlignment(textBox1, ErrorIconAlignment::BottomRight);

         // ggf. Fehlermeldung anzeigen
         if (textBox1->Text->IndexOf(' ') == -1)
         {
           errprov->SetError(textBox1, "Bitte Vor- und Nachnamen angeben!");
           e->Cancel = true;
         }
         else
            button1->Enabled = true;
      }
   private: System::Void button1_Click(System::Object^  sender, System::EventArgs^  e) {
               this->Close();
            }
};
}

