Hilfe bei Realisierung eines Projektes



  • Hallo Leute,

    Tut mir echt Leid dass ich eure Hilfe so sehr in Anspruch nehme und mir dass nicht durch Bücher erkläre, doch ich studiere zur Zeit und daher ist das ziemlich problematisch alles neben bei zu lesen...

    Also:

    Ich habe bisher diesen funktionierenden Code:

    (Bild zur veranschaulichung ganz unten... PS: Gibts hie rnicht die Möglicheit Bilder einzubinden? Die IMG variante jedenfalls klappt nicht...

    #pragma once
    #include <iostream>
    #include <stdio.h>
    #include <string.h>
    
    namespace Kochbuch64 {
    
    	using namespace System;
    	using namespace System::ComponentModel;
    	using namespace System::Collections;
    	using namespace System::Windows::Forms;
    	using namespace System::Data;
    	using namespace System::Drawing;
    	using namespace System::IO;
    
    	/// <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
    	{
    
    	public:
    		Form1(void)
    		{
    			InitializeComponent();
    			//
    			//TODO: Konstruktorcode hier hinzufügen.
    			//
    		}
    
    	protected:
    		/// <summary>
    		/// Verwendete Ressourcen bereinigen.
    		/// </summary>
    		~Form1()
    		{
    			if (components)
    			{
    				delete components;
    			}
    
    		}
    	private: System::Windows::Forms::ComboBox^  comboBox1;
    	protected: 
    
    	protected: 
    
    	protected: 
    
    	private: System::Windows::Forms::PictureBox^  foto;
    	private: System::Windows::Forms::TextBox^  textBox1;
    
    	private: System::Windows::Forms::TextBox^  textBox8;
    	private: System::Windows::Forms::TextBox^  zutaten;
    	private: System::Windows::Forms::TextBox^  textBox4;
    	private: System::Windows::Forms::TextBox^  schwierigkeit;
    	private: System::Windows::Forms::TextBox^  textBox9;
    	private: System::Windows::Forms::TextBox^  textBox6;
    	private: System::Windows::Forms::TextBox^  textBox7;
    	private: System::Windows::Forms::TextBox^  personen;
    	private: System::Windows::Forms::TextBox^  dauer;
    	private: System::Windows::Forms::TextBox^  textBox12;
    	private: System::Windows::Forms::GroupBox^  groupBox1;
    	private: System::Windows::Forms::GroupBox^  groupBox2;
    	private: System::Windows::Forms::GroupBox^  groupBox3;
    	public: System::Windows::Forms::TextBox^  Gericht;
    	private: System::Windows::Forms::ImageList^  imageList1;
    	public: System::Windows::Forms::TextBox^  Gericht2;
    
    	public: 
    
    	private: 
    
    	private: 
    
    	private: 
    	public: 
    	private: 
    
    	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(Form1::typeid));
    			this->comboBox1 = (gcnew System::Windows::Forms::ComboBox());
    			this->foto = (gcnew System::Windows::Forms::PictureBox());
    			this->textBox1 = (gcnew System::Windows::Forms::TextBox());
    			this->textBox8 = (gcnew System::Windows::Forms::TextBox());
    			this->zutaten = (gcnew System::Windows::Forms::TextBox());
    			this->textBox4 = (gcnew System::Windows::Forms::TextBox());
    			this->schwierigkeit = (gcnew System::Windows::Forms::TextBox());
    			this->textBox9 = (gcnew System::Windows::Forms::TextBox());
    			this->textBox6 = (gcnew System::Windows::Forms::TextBox());
    			this->textBox7 = (gcnew System::Windows::Forms::TextBox());
    			this->personen = (gcnew System::Windows::Forms::TextBox());
    			this->dauer = (gcnew System::Windows::Forms::TextBox());
    			this->textBox12 = (gcnew System::Windows::Forms::TextBox());
    			this->groupBox1 = (gcnew System::Windows::Forms::GroupBox());
    			this->groupBox2 = (gcnew System::Windows::Forms::GroupBox());
    			this->Gericht = (gcnew System::Windows::Forms::TextBox());
    			this->groupBox3 = (gcnew System::Windows::Forms::GroupBox());
    			this->Gericht2 = (gcnew System::Windows::Forms::TextBox());
    			this->imageList1 = (gcnew System::Windows::Forms::ImageList(this->components));
    			(cli::safe_cast<System::ComponentModel::ISupportInitialize^  >(this->foto))->BeginInit();
    			this->groupBox1->SuspendLayout();
    			this->groupBox2->SuspendLayout();
    			this->groupBox3->SuspendLayout();
    			this->SuspendLayout();
    			// 
    			// comboBox1
    			// 
    			this->comboBox1->DropDownStyle = System::Windows::Forms::ComboBoxStyle::DropDownList;
    			this->comboBox1->FormattingEnabled = true;
    			this->comboBox1->Items->AddRange(gcnew cli::array< System::Object^  >(2) {L"Eier in Schinken Senf Soße", L"Nutella"});
    			this->comboBox1->Location = System::Drawing::Point(12, 5);
    			this->comboBox1->Name = L"comboBox1";
    			this->comboBox1->Size = System::Drawing::Size(121, 21);
    			this->comboBox1->TabIndex = 1;
    			this->comboBox1->SelectedIndexChanged += gcnew System::EventHandler(this, &Form1::comboBox1_SelectedIndexChanged);
    			// 
    			// foto
    			// 
    			this->foto->Anchor = static_cast<System::Windows::Forms::AnchorStyles>((((System::Windows::Forms::AnchorStyles::Top | System::Windows::Forms::AnchorStyles::Bottom) 
    				| System::Windows::Forms::AnchorStyles::Left) 
    				| System::Windows::Forms::AnchorStyles::Right));
    			this->foto->BackgroundImageLayout = System::Windows::Forms::ImageLayout::Zoom;
    			this->foto->Enabled = false;
    			this->foto->ImageLocation = L"";
    			this->foto->InitialImage = nullptr;
    			this->foto->Location = System::Drawing::Point(426, 19);
    			this->foto->Name = L"foto";
    			this->foto->Size = System::Drawing::Size(392, 376);
    			this->foto->SizeMode = System::Windows::Forms::PictureBoxSizeMode::Zoom;
    			this->foto->TabIndex = 1;
    			this->foto->TabStop = false;
    			this->foto->WaitOnLoad = true;
    			// 
    			// textBox1
    			// 
    			this->textBox1->BorderStyle = System::Windows::Forms::BorderStyle::None;
    			this->textBox1->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 8.25F, static_cast<System::Drawing::FontStyle>((System::Drawing::FontStyle::Bold | System::Drawing::FontStyle::Underline)), 
    				System::Drawing::GraphicsUnit::Point, static_cast<System::Byte>(0)));
    			this->textBox1->Location = System::Drawing::Point(0, 19);
    			this->textBox1->Multiline = true;
    			this->textBox1->Name = L"textBox1";
    			this->textBox1->ReadOnly = true;
    			this->textBox1->Size = System::Drawing::Size(100, 20);
    			this->textBox1->TabIndex = 2;
    			this->textBox1->Text = L"Gericht:";
    			this->textBox1->TextChanged += gcnew System::EventHandler(this, &Form1::textBox1_TextChanged);
    			// 
    			// textBox8
    			// 
    			this->textBox8->BorderStyle = System::Windows::Forms::BorderStyle::None;
    			this->textBox8->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 8.25F, static_cast<System::Drawing::FontStyle>((System::Drawing::FontStyle::Bold | System::Drawing::FontStyle::Underline)), 
    				System::Drawing::GraphicsUnit::Point, static_cast<System::Byte>(0)));
    			this->textBox8->Location = System::Drawing::Point(184, 19);
    			this->textBox8->Multiline = true;
    			this->textBox8->Name = L"textBox8";
    			this->textBox8->ReadOnly = true;
    			this->textBox8->Size = System::Drawing::Size(100, 20);
    			this->textBox8->TabIndex = 9;
    			this->textBox8->Text = L"Zutaten:";
    			// 
    			// zutaten
    			// 
    			this->zutaten->BorderStyle = System::Windows::Forms::BorderStyle::None;
    			this->zutaten->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 8.25F, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point, 
    				static_cast<System::Byte>(0)));
    			this->zutaten->Location = System::Drawing::Point(199, 45);
    			this->zutaten->Multiline = true;
    			this->zutaten->Name = L"zutaten";
    			this->zutaten->ReadOnly = true;
    			this->zutaten->Size = System::Drawing::Size(221, 421);
    			this->zutaten->TabIndex = 10;
    			this->zutaten->TextChanged += gcnew System::EventHandler(this, &Form1::zutaten_TextChanged);
    			// 
    			// textBox4
    			// 
    			this->textBox4->BorderStyle = System::Windows::Forms::BorderStyle::None;
    			this->textBox4->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 8.25F, System::Drawing::FontStyle::Bold, System::Drawing::GraphicsUnit::Point, 
    				static_cast<System::Byte>(0)));
    			this->textBox4->Location = System::Drawing::Point(6, 45);
    			this->textBox4->Multiline = true;
    			this->textBox4->Name = L"textBox4";
    			this->textBox4->ReadOnly = true;
    			this->textBox4->Size = System::Drawing::Size(57, 20);
    			this->textBox4->TabIndex = 11;
    			this->textBox4->Text = L"Aufwand:";
    			this->textBox4->TextChanged += gcnew System::EventHandler(this, &Form1::textBox4_TextChanged);
    			// 
    			// schwierigkeit
    			// 
    			this->schwierigkeit->BorderStyle = System::Windows::Forms::BorderStyle::None;
    			this->schwierigkeit->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 8.25F, System::Drawing::FontStyle::Bold, System::Drawing::GraphicsUnit::Point, 
    				static_cast<System::Byte>(0)));
    			this->schwierigkeit->Location = System::Drawing::Point(81, 45);
    			this->schwierigkeit->Multiline = true;
    			this->schwierigkeit->Name = L"schwierigkeit";
    			this->schwierigkeit->ReadOnly = true;
    			this->schwierigkeit->Size = System::Drawing::Size(100, 20);
    			this->schwierigkeit->TabIndex = 12;
    			this->schwierigkeit->Text = L"Leicht";
    			// 
    			// textBox9
    			// 
    			this->textBox9->BorderStyle = System::Windows::Forms::BorderStyle::None;
    			this->textBox9->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 8.25F, static_cast<System::Drawing::FontStyle>((System::Drawing::FontStyle::Bold | System::Drawing::FontStyle::Underline)), 
    				System::Drawing::GraphicsUnit::Point, static_cast<System::Byte>(0)));
    			this->textBox9->Location = System::Drawing::Point(6, 484);
    			this->textBox9->Multiline = true;
    			this->textBox9->Name = L"textBox9";
    			this->textBox9->ReadOnly = true;
    			this->textBox9->Size = System::Drawing::Size(100, 20);
    			this->textBox9->TabIndex = 13;
    			this->textBox9->Text = L"Zubereitung::";
    			// 
    			// textBox6
    			// 
    			this->textBox6->BorderStyle = System::Windows::Forms::BorderStyle::None;
    			this->textBox6->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 8.25F, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point, 
    				static_cast<System::Byte>(0)));
    			this->textBox6->Location = System::Drawing::Point(0, 510);
    			this->textBox6->Multiline = true;
    			this->textBox6->Name = L"textBox6";
    			this->textBox6->ReadOnly = true;
    			this->textBox6->Size = System::Drawing::Size(805, 187);
    			this->textBox6->TabIndex = 14;
    			// 
    			// textBox7
    			// 
    			this->textBox7->BorderStyle = System::Windows::Forms::BorderStyle::None;
    			this->textBox7->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 8.25F, System::Drawing::FontStyle::Bold, System::Drawing::GraphicsUnit::Point, 
    				static_cast<System::Byte>(0)));
    			this->textBox7->Location = System::Drawing::Point(6, 19);
    			this->textBox7->Multiline = true;
    			this->textBox7->Name = L"textBox7";
    			this->textBox7->ReadOnly = true;
    			this->textBox7->Size = System::Drawing::Size(29, 20);
    			this->textBox7->TabIndex = 15;
    			this->textBox7->Text = L"Für:";
    			// 
    			// personen
    			// 
    			this->personen->BorderStyle = System::Windows::Forms::BorderStyle::None;
    			this->personen->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 8.25F, System::Drawing::FontStyle::Bold, System::Drawing::GraphicsUnit::Point, 
    				static_cast<System::Byte>(0)));
    			this->personen->Location = System::Drawing::Point(81, 19);
    			this->personen->Multiline = true;
    			this->personen->Name = L"personen";
    			this->personen->ReadOnly = true;
    			this->personen->Size = System::Drawing::Size(100, 20);
    			this->personen->TabIndex = 16;
    			this->personen->Text = L"2 Personen";
    			// 
    			// dauer
    			// 
    			this->dauer->BorderStyle = System::Windows::Forms::BorderStyle::None;
    			this->dauer->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 8.25F, System::Drawing::FontStyle::Bold, System::Drawing::GraphicsUnit::Point, 
    				static_cast<System::Byte>(0)));
    			this->dauer->Location = System::Drawing::Point(81, 71);
    			this->dauer->Multiline = true;
    			this->dauer->Name = L"dauer";
    			this->dauer->ReadOnly = true;
    			this->dauer->Size = System::Drawing::Size(110, 20);
    			this->dauer->TabIndex = 17;
    			this->dauer->Text = L"20 Min.";
    			// 
    			// textBox12
    			// 
    			this->textBox12->BorderStyle = System::Windows::Forms::BorderStyle::None;
    			this->textBox12->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 8.25F, System::Drawing::FontStyle::Bold, System::Drawing::GraphicsUnit::Point, 
    				static_cast<System::Byte>(0)));
    			this->textBox12->Location = System::Drawing::Point(6, 71);
    			this->textBox12->Multiline = true;
    			this->textBox12->Name = L"textBox12";
    			this->textBox12->ReadOnly = true;
    			this->textBox12->Size = System::Drawing::Size(42, 20);
    			this->textBox12->TabIndex = 18;
    			this->textBox12->Text = L"Dauer:";
    			// 
    			// groupBox1
    			// 
    			this->groupBox1->Controls->Add(this->dauer);
    			this->groupBox1->Controls->Add(this->textBox12);
    			this->groupBox1->Controls->Add(this->textBox4);
    			this->groupBox1->Controls->Add(this->schwierigkeit);
    			this->groupBox1->Controls->Add(this->personen);
    			this->groupBox1->Controls->Add(this->textBox7);
    			this->groupBox1->Location = System::Drawing::Point(6, 71);
    			this->groupBox1->Name = L"groupBox1";
    			this->groupBox1->Size = System::Drawing::Size(155, 103);
    			this->groupBox1->TabIndex = 19;
    			this->groupBox1->TabStop = false;
    			this->groupBox1->Text = L"Infos:";
    			// 
    			// groupBox2
    			// 
    			this->groupBox2->Controls->Add(this->textBox1);
    			this->groupBox2->Controls->Add(this->groupBox1);
    			this->groupBox2->Controls->Add(this->Gericht);
    			this->groupBox2->Location = System::Drawing::Point(6, 0);
    			this->groupBox2->Name = L"groupBox2";
    			this->groupBox2->Size = System::Drawing::Size(172, 466);
    			this->groupBox2->TabIndex = 20;
    			this->groupBox2->TabStop = false;
    			// 
    			// Gericht
    			// 
    			this->Gericht->BackColor = System::Drawing::SystemColors::Control;
    			this->Gericht->BorderStyle = System::Windows::Forms::BorderStyle::None;
    			this->Gericht->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 10));
    			this->Gericht->Location = System::Drawing::Point(6, 45);
    			this->Gericht->Multiline = true;
    			this->Gericht->Name = L"Gericht";
    			this->Gericht->Size = System::Drawing::Size(149, 20);
    			this->Gericht->TabIndex = 15;
    			// 
    			// groupBox3
    			// 
    			this->groupBox3->Controls->Add(this->Gericht2);
    			this->groupBox3->Controls->Add(this->textBox8);
    			this->groupBox3->Controls->Add(this->zutaten);
    			this->groupBox3->Controls->Add(this->groupBox2);
    			this->groupBox3->Controls->Add(this->textBox9);
    			this->groupBox3->Controls->Add(this->textBox6);
    			this->groupBox3->Controls->Add(this->foto);
    			this->groupBox3->Location = System::Drawing::Point(12, 32);
    			this->groupBox3->Name = L"groupBox3";
    			this->groupBox3->Size = System::Drawing::Size(826, 703);
    			this->groupBox3->TabIndex = 0;
    			this->groupBox3->TabStop = false;
    			this->groupBox3->Visible = false;
    			// 
    			// Gericht2
    			// 
    			this->Gericht2->BackColor = System::Drawing::SystemColors::Control;
    			this->Gericht2->BorderStyle = System::Windows::Forms::BorderStyle::None;
    			this->Gericht2->Cursor = System::Windows::Forms::Cursors::Arrow;
    			this->Gericht2->Font = (gcnew System::Drawing::Font(L"Calibri", 13));
    			this->Gericht2->ImeMode = System::Windows::Forms::ImeMode::NoControl;
    			this->Gericht2->Location = System::Drawing::Point(483, 401);
    			this->Gericht2->Multiline = true;
    			this->Gericht2->Name = L"Gericht2";
    			this->Gericht2->ReadOnly = true;
    			this->Gericht2->Size = System::Drawing::Size(322, 20);
    			this->Gericht2->TabIndex = 21;
    			// 
    			// imageList1
    			// 
    			this->imageList1->ImageStream = (cli::safe_cast<System::Windows::Forms::ImageListStreamer^  >(resources->GetObject(L"imageList1.ImageStream")));
    			this->imageList1->TransparentColor = System::Drawing::Color::Transparent;
    			this->imageList1->Images->SetKeyName(0, L"watermark_F2049201jpg_img_308x0.png");
    			this->imageList1->Images->SetKeyName(1, L"00.jpg");
    			this->imageList1->Images->SetKeyName(2, L"01.jpg");
    			this->imageList1->Images->SetKeyName(3, L"02.jpg");
    			this->imageList1->Images->SetKeyName(4, L"03.jpg");
    			this->imageList1->Images->SetKeyName(5, L"04.jpg");
    			this->imageList1->Images->SetKeyName(6, L"05.jpg");
    			this->imageList1->Images->SetKeyName(7, L"06.jpg");
    			this->imageList1->Images->SetKeyName(8, L"07.jpg");
    			this->imageList1->Images->SetKeyName(9, L"08.jpg");
    			this->imageList1->Images->SetKeyName(10, L"09.jpg");
    			this->imageList1->Images->SetKeyName(11, L"10.jpg");
    			this->imageList1->Images->SetKeyName(12, L"11.jpg");
    			this->imageList1->Images->SetKeyName(13, L"12.jpg");
    			this->imageList1->Images->SetKeyName(14, L"13.jpg");
    			this->imageList1->Images->SetKeyName(15, L"14.jpg");
    			this->imageList1->Images->SetKeyName(16, L"15.jpg");
    			this->imageList1->Images->SetKeyName(17, L"16.jpg");
    			this->imageList1->Images->SetKeyName(18, L"17.jpg");
    			this->imageList1->Images->SetKeyName(19, L"18.jpg");
    			this->imageList1->Images->SetKeyName(20, L"19.jpg");
    			this->imageList1->Images->SetKeyName(21, L"20.jpg");
    			this->imageList1->Images->SetKeyName(22, L"21.jpg");
    			this->imageList1->Images->SetKeyName(23, L"22.jpg");
    			this->imageList1->Images->SetKeyName(24, L"23.jpg");
    			this->imageList1->Images->SetKeyName(25, L"24.jpg");
    			// 
    			// Form1
    			// 
    			this->AutoScaleDimensions = System::Drawing::SizeF(6, 13);
    			this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
    			this->ClientSize = System::Drawing::Size(850, 747);
    			this->Controls->Add(this->groupBox3);
    			this->Controls->Add(this->comboBox1);
    			this->Name = L"Form1";
    			this->Text = L"Form1";
    			(cli::safe_cast<System::ComponentModel::ISupportInitialize^  >(this->foto))->EndInit();
    			this->groupBox1->ResumeLayout(false);
    			this->groupBox1->PerformLayout();
    			this->groupBox2->ResumeLayout(false);
    			this->groupBox2->PerformLayout();
    			this->groupBox3->ResumeLayout(false);
    			this->groupBox3->PerformLayout();
    			this->ResumeLayout(false);
    
    		}
    #pragma endregion
    	private: System::Void saveFileDialog1_FileOk(System::Object^  sender, System::ComponentModel::CancelEventArgs^  e) {
    			 }
    private: System::Void textBox1_TextChanged(System::Object^  sender, System::EventArgs^  e) {
    		 }
    private: System::Void zutaten_TextChanged(System::Object^  sender, System::EventArgs^  e) {
    		 }
    private: System::Void textBox4_TextChanged(System::Object^  sender, System::EventArgs^  e) {
    		 }
    private: System::Void button1_Click(System::Object^  sender, System::EventArgs^  e) {
    
    		 }
    		 // EIER SENF SOße
    private: System::Void comboBox1_SelectedIndexChanged(System::Object^  sender, System::EventArgs^  e) {
    			 if(comboBox1->SelectedItem=="Eier in Schinken Senf Soße")
    			 {
    				 this->groupBox3->Visible = true;
    
    			 }
    			 if(comboBox1->SelectedItem=="Eier in Schinken Senf Soße" ) 
                { 
                    this->Gericht->Text = "Eier in Schinken Senf Soße";
    				this->Gericht->Refresh();
                }
    			 if(comboBox1->SelectedItem=="Eier in Schinken Senf Soße" ) 
                { 
                    this->Gericht2->Text = "Eier in Schinken Senf Soße";
    				this->Gericht2->Refresh();
                }
    
    			 if(comboBox1->SelectedItem=="Eier in Schinken Senf Soße") 
                { 
                    this->zutaten->Text = "-8 Eier \r\n-75 g fertige Schinkenwürfel \r\n-1/2 l Milch \r\n-1/2 Bund Schnittlauch \r\n-Aus dem Vorrat: \r\n-1 mittelgroße Zwiebel \r\n-3 EL (45 g) Butter/Margarine \r\n-3 leicht geh. EL (45 g) Mehl \r\n-1-2 TL Gemüsebrühe (Instant) \r\n-2-3 EL mittelscharfer Senf \r\n-4 Portionen Kartoffelpüree (mit Milch)\r\n-Salz, Pfeffer";
    				this->zutaten->Refresh();
                }
    
    			 if(comboBox1->SelectedItem=="Eier in Schinken Senf Soße") 
                { 
                    this->personen->Text = "2 Personen";
    				this->personen->Refresh();
                }
    			 if(comboBox1->SelectedItem=="Eier in Schinken Senf Soße") 
                { 
                    this->schwierigkeit->Text = "Leicht";
    				this->schwierigkeit->Refresh();
                }
    			 if(comboBox1->SelectedItem=="Eier in Schinken Senf Soße") 
                { 
                    this->dauer->Text = "20 Min.";
    				this->dauer->Refresh();
                }
    			  if(comboBox1->SelectedItem=="Eier in Schinken Senf Soße") 
                { 
    
    				this->foto->Image = Image::FromFile ("25.png");
    				this->foto->Refresh();
                }
    			  // ENDE       EIER SENF SOße
    			  if(comboBox1->SelectedItem=="Nutella")
    			 {
    				 this->groupBox3->Visible = true;
    
    			 }
    			 if(comboBox1->SelectedItem=="Nutella" ) 
                { 
                    this->Gericht->Text = "Nutella";
    				this->Gericht->Refresh();
                }
    			 if(comboBox1->SelectedItem=="Nutella" ) 
                { 
                    this->Gericht2->Text = "Nutella";
    				this->Gericht2->Refresh();
                }
    
    			 if(comboBox1->SelectedItem=="Nutella") 
                { 
                    this->zutaten->Text = "";
    				this->zutaten->Refresh();
                }
    
    			 if(comboBox1->SelectedItem=="Nutella") 
                { 
                    this->personen->Text = "2 Personen";
    				this->personen->Refresh();
                }
    			 if(comboBox1->SelectedItem=="Nutella") 
                { 
                    this->schwierigkeit->Text = "Leicht";
    				this->schwierigkeit->Refresh();
                }
    			 if(comboBox1->SelectedItem=="Nutella") 
                { 
                    this->dauer->Text = "20 Min.";
    				this->dauer->Refresh();
                }
    			  if(comboBox1->SelectedItem=="Nutella") 
                { 
    
    				this->foto->Image = Image::FromFile ("nutella2.jpg");
    				this->foto->Refresh();
                }
    		 }
    
    };
    
    }
    

    Es soll eine Art "Kochbuch" werden. (Nicht lachen 😉 )
    Also ich möchte nun realisieren dass der Benutzer selber Gerichte hinzufügen kann, mit Bild, Rezept und Zutaten.
    Mein Ansatz war, eine Form 2 öffnen zu lassen in welcher man zur Eingabe aller
    Daten aufgefordert wird.

    Sachen die ich weiß:

    -2 Form erstellen und über Form 1 öffnen
    -Dialog in Form 2 mit Eingabe etc

    Sachen die ich nicht weiß (Leider um einiges mehr):
    -Datentransfer zwischen Form 1 und Form 2
    -Abspeichern der eingegebenen Daten im Programm selber. Dh. man soll überall
    Zugriff auf die eingegebenen Daten haben und nicht nur am eigenen PC.

    Wäre echt genial wenn ihr mir vielleicht immer so ein zwei Stichpunkte oder Tipps geben würdet.

    Aber bitte keine MSDN Links aus denen werd ich einfach nicht schlau, tut mir Leid.

    http://img155.imageshack.us/img155/1328/programmq.png
    Hier mal ein Bild um es etwas genauer zu veranschaulichen!



  • Kannst Du das nächste Mal bitte den *relevanten* Codeteil posten, womit Du probleme hast???

    Sonst verschiebe ich es ins Projekte Forum, da kannst Du dann jemand bezahlen, der dass alles immer lesen soll...

    Von mir wirst Du nur eine Antwort bekommen, wenn Du mir Dein Problem erklärst, und was Du versucht hast... und das ohne hunderte von Code-Zeilen zu posten...



  • Also entscheidet euch mal... Wenn ich nur den betroffenen Abschnitt Poste sagen alle, ooste den ganzen Code, wenns ichs dann mache, nimm den betroffenen Code...

    ja, ok also was ista ber nun der betroffene Code?
    Hm, ok, hier:

    if(comboBox1->SelectedItem=="Eier in Schinken Senf Soße" ) 
                { 
                    this->Gericht->Text = "Eier in Schinken Senf Soße";
    				this->Gericht->Refresh();
    
                    this->Gericht2->Text = "Eier in Schinken Senf Soße";
    				this->Gericht2->Refresh();
    
                    this->zutaten->Text = "-8 Eier \r\n-75 g fertige Schinkenwürfel \r\n-1/2 l Milch \r\n-1/2 Bund Schnittlauch \r\n-Aus dem Vorrat: \r\n-1 mittelgroße Zwiebel \r\n-3 EL (45 g) Butter/Margarine \r\n-3 leicht geh. EL (45 g) Mehl \r\n-1-2 TL Gemüsebrühe (Instant) \r\n-2-3 EL mittelscharfer Senf \r\n-4 Portionen Kartoffelpüree (mit Milch)\r\n-Salz, Pfeffer";
    				this->zutaten->Refresh();
    
                    this->personen->Text = "2 Personen";
    				this->personen->Refresh();
    
                    this->schwierigkeit->Text = "Leicht";
    				this->schwierigkeit->Refresh();
    
                    this->dauer->Text = "20 Min.";
    				this->dauer->Refresh();
    
    				this->foto->Image = Image::FromFile ("25.png");
    				this->foto->Refresh();
                }
    

    Also:

    Das sind alles Angaben für das Rezept Eier-Senf-Soße(oä). Nun möchte ich einen wissen wie ich eine .ini?! Datei erstelle die ein Rezept speichern kann, welches man selber eingegeben hat. ich erstelle Grad mal Form 2 und poste den Code, ist dann vielleicht Einfacher für euch.
    Zu dem weiß ich nicht wie Form1 Daten aus Form2 auslesen kann...



  • So, hier die Passage habe ich nun Form1 hinzugefügt:

    if(comboBox1->SelectedItem=="<Neu>")
    			 {
    				 Form2^ fenster;
    				 fenster = gcnew Form2();
    				 fenster->Show();
    
    			 }
    

    und Form2 beinhaltet lediglich die Textboxen 1-10 (1-5 Readonly =true | 6-10 Readonly = false) In diese soll man dann Daten eingeben soll. Mit einem OpenFileDialog soll man noch ein Bild auswählen. Doch wie ich das anstellen soll weiß ich noch nicht so ganz. Ich habe zwar den Code:

    OpenFileDialog ^ openFileDialog1 = gcnew OpenFileDialog(); 
                    openFileDialog1->InitialDirectory = "C:\\"; 
                    openFileDialog1->Filter = ""; 
                    openFileDialog1->Title = "Bild auswählen";
    

    Aber wie ich dann das ausgewählte Bild in die PictureBox in Form1 bekomme und alles zusammen gespeichert bekomme, ist mir noch ein Rätsel..
    Hier der komplette Code aus Form 2, falls der benötigt seinen sollte (ab prgma region Windows Form

    #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->Gericht = (gcnew System::Windows::Forms::TextBox());
    			this->textBox2 = (gcnew System::Windows::Forms::TextBox());
    			this->textBox3 = (gcnew System::Windows::Forms::TextBox());
    			this->textBox4 = (gcnew System::Windows::Forms::TextBox());
    			this->textBox5 = (gcnew System::Windows::Forms::TextBox());
    			this->textBox7 = (gcnew System::Windows::Forms::TextBox());
    			this->textBox8 = (gcnew System::Windows::Forms::TextBox());
    			this->textBox9 = (gcnew System::Windows::Forms::TextBox());
    			this->openFileDialog1 = (gcnew System::Windows::Forms::OpenFileDialog());
    			this->textBox1 = (gcnew System::Windows::Forms::TextBox());
    			this->button1 = (gcnew System::Windows::Forms::Button());
    			this->SuspendLayout();
    			// 
    			// Gericht
    			// 
    			this->Gericht->BackColor = System::Drawing::SystemColors::Control;
    			this->Gericht->BorderStyle = System::Windows::Forms::BorderStyle::None;
    			this->Gericht->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 10));
    			this->Gericht->Location = System::Drawing::Point(12, 26);
    			this->Gericht->Multiline = true;
    			this->Gericht->Name = L"Gericht";
    			this->Gericht->Size = System::Drawing::Size(149, 20);
    			this->Gericht->TabIndex = 16;
    			this->Gericht->Text = L"Name:";
    			// 
    			// textBox2
    			// 
    			this->textBox2->BackColor = System::Drawing::SystemColors::Control;
    			this->textBox2->BorderStyle = System::Windows::Forms::BorderStyle::None;
    			this->textBox2->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 10));
    			this->textBox2->Location = System::Drawing::Point(12, 88);
    			this->textBox2->Multiline = true;
    			this->textBox2->Name = L"textBox2";
    			this->textBox2->Size = System::Drawing::Size(149, 20);
    			this->textBox2->TabIndex = 18;
    			this->textBox2->Text = L"Zutaten";
    			// 
    			// textBox3
    			// 
    			this->textBox3->BackColor = System::Drawing::SystemColors::Control;
    			this->textBox3->BorderStyle = System::Windows::Forms::BorderStyle::None;
    			this->textBox3->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 10));
    			this->textBox3->Location = System::Drawing::Point(12, 123);
    			this->textBox3->Multiline = true;
    			this->textBox3->Name = L"textBox3";
    			this->textBox3->Size = System::Drawing::Size(149, 20);
    			this->textBox3->TabIndex = 19;
    			this->textBox3->Text = L"Für: /Personen";
    			// 
    			// textBox4
    			// 
    			this->textBox4->BackColor = System::Drawing::SystemColors::Control;
    			this->textBox4->BorderStyle = System::Windows::Forms::BorderStyle::None;
    			this->textBox4->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 10));
    			this->textBox4->Location = System::Drawing::Point(12, 149);
    			this->textBox4->Multiline = true;
    			this->textBox4->Name = L"textBox4";
    			this->textBox4->Size = System::Drawing::Size(149, 20);
    			this->textBox4->TabIndex = 20;
    			this->textBox4->Text = L"Zubereitung";
    			// 
    			// textBox5
    			// 
    			this->textBox5->Location = System::Drawing::Point(194, 26);
    			this->textBox5->Name = L"textBox5";
    			this->textBox5->Size = System::Drawing::Size(100, 20);
    			this->textBox5->TabIndex = 21;
    			// 
    			// textBox7
    			// 
    			this->textBox7->Location = System::Drawing::Point(194, 149);
    			this->textBox7->Name = L"textBox7";
    			this->textBox7->Size = System::Drawing::Size(100, 20);
    			this->textBox7->TabIndex = 23;
    			// 
    			// textBox8
    			// 
    			this->textBox8->Location = System::Drawing::Point(194, 123);
    			this->textBox8->Name = L"textBox8";
    			this->textBox8->Size = System::Drawing::Size(100, 20);
    			this->textBox8->TabIndex = 24;
    			this->textBox8->TextChanged += gcnew System::EventHandler(this, &Form2::textBox8_TextChanged);
    			// 
    			// textBox9
    			// 
    			this->textBox9->Location = System::Drawing::Point(194, 87);
    			this->textBox9->Name = L"textBox9";
    			this->textBox9->Size = System::Drawing::Size(100, 20);
    			this->textBox9->TabIndex = 25;
    			// 
    			// openFileDialog1
    			// 
    			this->openFileDialog1->FileName = L"openFileDialog1";
    			// 
    			// textBox1
    			// 
    			this->textBox1->BackColor = System::Drawing::SystemColors::Control;
    			this->textBox1->BorderStyle = System::Windows::Forms::BorderStyle::None;
    			this->textBox1->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 10));
    			this->textBox1->Location = System::Drawing::Point(12, 62);
    			this->textBox1->Multiline = true;
    			this->textBox1->Name = L"textBox1";
    			this->textBox1->Size = System::Drawing::Size(149, 20);
    			this->textBox1->TabIndex = 17;
    			this->textBox1->Text = L"Bild Adresse:";
    			// 
    			// button1
    			// 
    			this->button1->Location = System::Drawing::Point(194, 59);
    			this->button1->Name = L"button1";
    			this->button1->Size = System::Drawing::Size(75, 23);
    			this->button1->TabIndex = 26;
    			this->button1->Text = L"Auswählen";
    			this->button1->UseVisualStyleBackColor = true;
    			this->button1->Click += gcnew System::EventHandler(this, &Form2::button1_Click);
    			// 
    			// Form2
    			// 
    			this->AutoScaleDimensions = System::Drawing::SizeF(6, 13);
    			this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
    			this->ClientSize = System::Drawing::Size(665, 356);
    			this->Controls->Add(this->button1);
    			this->Controls->Add(this->textBox9);
    			this->Controls->Add(this->textBox8);
    			this->Controls->Add(this->textBox7);
    			this->Controls->Add(this->textBox5);
    			this->Controls->Add(this->textBox4);
    			this->Controls->Add(this->textBox3);
    			this->Controls->Add(this->textBox2);
    			this->Controls->Add(this->textBox1);
    			this->Controls->Add(this->Gericht);
    			this->Name = L"Form2";
    			this->Text = L"Form2";
    			this->Load += gcnew System::EventHandler(this, &Form2::Form2_Load);
    			this->ResumeLayout(false);
    			this->PerformLayout();
    
    		}
    #pragma endregion
    	private: System::Void Form2_Load(System::Object^  sender, System::EventArgs^  e) {
    			 }
    	private: System::Void textBox8_TextChanged(System::Object^  sender, System::EventArgs^  e) {
    			 }
    private: System::Void button1_Click(System::Object^  sender, System::EventArgs^  e) {
    			 OpenFileDialog ^ openFileDialog1 = gcnew OpenFileDialog(); 
                    openFileDialog1->InitialDirectory = "C:\\"; 
                    openFileDialog1->Filter = ""; 
                    openFileDialog1->Title = "Bild auswählen";
    		 }
    };
    }
    

    Liebe Grüße,



  • Hab jetzt einen anderen Weg versucht als den direkten Transfer welcher mir auch logischer erscheint.

    Ich habe nun diesen Code, welcher natürlich mal wieder mit etlichen Fehlern bestückt ist:

    private: System::Void button1_Click(System::Object^  sender, System::EventArgs^  e) {
    			  WritePrivateProfileString("common","EinPfad","c:\\lol\\","test.ini"); 
    WritePrivateProfileString("common","Nochwas","1","test.ini"); 
    WritePrivateProfileString("bla","test","0","test.ini");
    
    		 }
    

    Whats the matter?

    Fehleranalyse:

    1>c:\users\sebastian\desktop\cpp2\kochbuch64\Form2.h(228) : error C2664: 'WritePrivateProfileStringW': Konvertierung des Parameters 1 von 'const char [7]' in 'LPCWSTR' nicht möglich
    1>        Die Typen, auf die verwiesen wird, sind nicht verknüpft; die Konvertierung erfordert einen reinterpret_cast-Operator oder eine Typumwandlung im C- oder Funktionsformat.
    1>c:\users\sebastian\desktop\cpp2\kochbuch64\Form2.h(229) : error C2664: 'WritePrivateProfileStringW': Konvertierung des Parameters 1 von 'const char [7]' in 'LPCWSTR' nicht möglich
    1>        Die Typen, auf die verwiesen wird, sind nicht verknüpft; die Konvertierung erfordert einen reinterpret_cast-Operator oder eine Typumwandlung im C- oder Funktionsformat.
    1>c:\users\sebastian\desktop\cpp2\kochbuch64\Form2.h(230) : error C2664: 'WritePrivateProfileStringW': Konvertierung des Parameters 1 von 'const char [4]' in 'LPCWSTR' nicht möglich
    1>        Die Typen, auf die verwiesen wird, sind nicht verknüpft; die Konvertierung erfordert einen reinterpret_cast-Operator oder eine Typumwandlung im C- oder Funktionsformat.
    1>Code wird generiert...
    1>Das Buildprotokoll wurde unter "file://c:\Users\Sebastian\Desktop\cpp2\Kochbuch64\Debug\BuildLog.htm" gespeichert.
    1>Kochbuch64 - 6 Fehler, 0 Warnung(en)
    ========== Erstellen: 0 erfolgreich, Fehler bei 1, 0 aktuell, 0 übersprungen ==========
    




  • Done.

    Doch die .ini lässt sich nirgendwo auffinden... Seltsam?!

    private: System::Void button1_Click(System::Object^  sender, System::EventArgs^  e) {
    			 WritePrivateProfileString("Allgemein","Vorname","Udo","test3.ini"); 
    			 WritePrivateProfileString("Allgemein","Name","Schmidt","test3.ini"); 
    
    		 }
    


  • Du mischst native C++ und C++/CLI (managed)... nur als Hinweis - lies die Doku zu den API Funktionen.



  • Ach Leute ich weiß nicht wie ich es angehen soll...

    Wie würdet ihr es denn machen? Ich beschreibe euch mal meine Wunschlösung und mein Ziel.

    Das Programm ist ein Rezeptbuch. Ich möchte vom Nutzer neue Rezepte aufnehmen können, über das Eingabeformular Form2. 
    Da Form1 gewitzter Weise natürlich sofort die eingegebenen Daten empfängt und in eine "Vorlage"
    (Siehe weiter unten)  einfügt hat kann man dieses Rezept bei neustart bequem über die ComboBox1 aufrufen.
    

    Wie bekomme ich das hin?
    Einmal dachte ich an das speichern mit .ini Files. Problem: Ich müsste die Vorlage vorher einfügen & und das praktisch unendlich oft denn ich weiß ja nicht wie viele Rezepte der Benutzer hinzufügen will.

    Mein Zweiter Gedanke:
    Mit Datentransfers der Beiden Forms. Jetzt Mal excel-like erklärt.

    //Wenn Bei form 2 neues Rezept eingegeben -> Füge neues Grundmodell ein
    
    ( 
    
    if(comboBox1->SelectedItem=="" ) 
                { 
                    this->Gericht->Text = "";
    				this->Gericht->Refresh();
    
                    this->Gericht2->Text = "";
    				this->Gericht2->Refresh();
    
                    this->zutaten->Text = "";
    				this->zutaten->Refresh();
    
                    this->personen->Text = "";
    				this->personen->Refresh();
    
                    this->schwierigkeit->Text = "";
    				this->schwierigkeit->Refresh();
    
                    this->dauer->Text = "";
    				this->dauer->Refresh();
    
    				this->foto->Image = Image::FromFile ("");
    				this->foto->Refresh();
    
    )
    
    Und fülle es mit den gegebenen Daten und SPeichern.
    

    Wobei mir der Zweite Weg um 1000x Lieber wäre, da halt Problem von Weg1 nicht da wäre, FALS dieser verrückte Gedanke mit dieser Art von "Vorlage" realisierbar seien sollte.

    Bitte, bitte helft mir 🙄



  • Hat den keiner ne Idee?



  • Datenbank?
    Oder sonstige Struktur... z.B. pro Rezept eine Datei... die Dateien per XmlSerializer schreiben/lesen...



  • Ich trau mich schon fast gar nicht mehr nach dem Wie zu fragen -.-



  • Ach ja:

    if(comboBox1->SelectedItem=="Eier in Schinken Senf Soße" ) 
                { 
    				WritePrivateProfileString("Allgemein","Vorname", 
                                "Udsdgdsgsdgsdgsdgo","C:\\test.ini"); 
    				WritePrivateProfileString("Allgemein","Name", 
                                "Schmdfsdgsdgsdgidt","C:\\tdfgdest.ini");
    

    Der Kram geht zwar aber die .ini wird nirgends erstellt. Warum? Wenn ich im DEV-C++ einfach nur

    #include <windows.h> 
    
    int main() 
    {  
      WritePrivateProfileString("Allgemein","Vorname", 
                                "Udo","C:\\test.ini"); 
      WritePrivateProfileString("Allgemein","Name", 
                                "Schmidt","C:\\test.ini");   
      return 0; 
    }
    

    mache gehts, aber ne beim teueren VS2008 natürlich nicht?!



  • Die Datei wird vermutlich nicht erstellt, da Du keine Zugriffsrechte hast... und so lange Du keine Rückgabewerte auswertest, kanst Du nicht behaupten, dass es geht...

    Erstelle sie am besten in einem Verzeichnis wo Du schreiben kannst...

    String ^path = System::Environment::GetFolderPath(System::Environment::SpecialFolder::Personal);
    String ^fileName = System::IO::Path::Combine(path, "DateiName.txt");
    

    Und für den XmlSerializer siehe:
    http://lmgtfy.com/?q=XmlSerializer



  • ja das seltsame ist aber doch das der exakte code im DEC C++ geht, oder? Na Ich probiers mal aus. Danke dir 🙂

    Aber ich glaub hab schonmal versucht das aufn desktop zu schreiben und ging auch nciht, aber dann halt nochmal...

    Muss ich den Pfad so angeben

    C:\\Dektop\test.ini
    oder wie? Manche schrieben ua auch in diesem Forum man soll nicht den ganzen Pfad eingeben?!



  • Und wofür ist der Code?

    String ^path = System::Environment::GetFolderPath(System::Environment::SpecialFolder::Personal); 
    String ^fileName = System::IO::Path::Combine(path, "DateiName.txt");
    

    ? Soll ich den dazuschreiben, aber was will ich mit einer Txt, und allgemein würd ich lieber verstehen als einfach nur copy & paste, auch zu eurem Wohle, dann muss ich nicht so oft nerven 😉



  • Mein Rat:
    - Verwende entweder C# oder C/C++ aber *nicht* C++/CLI... das ist nicht für Anfänger gedacht!!!!



  • Ja, jetzt hab ich aber angefangen und das ist somit dast die letzte Hürde, und jetzt nochmal neu bei einer anderen Sprache anfangen wäre dumm... Heute ist mein A-Z Lexikon C++ gekommen, werde danach dann darauf umsteigen. Aber bitte helft mir doch nur noch ein mal 😞

    Und ne Noob-Frage: Mit C++, kann ma damit auch grafische oberflächen erstellen? Wenn ja muss dass doch wahnsinnig kompliziert sein, oder?



  • Mit C/C++ kann man alles machen. Die Komplexität ist manchmal aber nicht zu unterschäzen...



  • Malarkey. schrieb:

    Ja, jetzt hab ich aber angefangen und das ist somit dast die letzte Hürde, und jetzt nochmal neu bei einer anderen Sprache anfangen wäre dumm...

    Nein es wäre sinnvoll.

    Außerdem ist das Speichern der Rezepte nicht die "letzte Hürde". Dein Code ist total verhurt und absolut nicht dafür ausgelegt um so etwas zu realisieren.

    Musst Du dieses Programm schreiben oder warum willst Du einfach nicht verstehen, dass Dir ALLE Grundlagen fehlen um so etwas zu realisieren?

    Und da Du nur schnell schnell zum Ziel kommen willst rate ich Dir dringend von C++ (nicht nur von C++/CLI) ab.


Anmelden zum Antworten