Willkommen
myGully
Links
Forum
07.07.10, 16:59
#1
Erfahrener Newbie
Registriert seit: Jul 2010
Beiträge: 111
Bedankt: 1
Wie Form2 per Button von Form 1 öffnen?
Hallo alle Mitewinander.
Ich habe das problem das ich es irgendiwe nicht hinbekomme
die 2. Form per Bottun von der 1. Form zu öffnen.
Vieleicht könnt ihr mir ja helfen.
Ich bedanke mich schonmal für die Antworten im Voraus.
MfG moin2010
07.07.10, 18:48
#2
Banned
Registriert seit: Sep 2008
Beiträge: 15
Bedankt: 5.160
Leider gibst du wenige detail um was es sich handelt was für Programm und was du machen willst..
da muss ein syntaxfehler sein ..! poste die code hier oder per PN...
MfG ilumi...
08.07.10, 14:56
#3
Erfahrener Newbie
Registriert seit: Jul 2010
Beiträge: 111
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, 15:50
#4
Erfahrener Newbie
Registriert seit: Jul 2010
Beiträge: 111
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?
08.07.10, 16:14
#5
Erfahrener Newbie
Registriert seit: Jul 2010
Beiträge: 111
Bedankt: 1
Jetzt habe ich nur noch die Fehlermeldung:
Fehler 102 error C2143: Syntaxfehler: Es fehlt ';' vor '->'
Ich habe auch diesen Fehler ausprobiert zu begleichen aber geht nicht.
08.07.10, 16:34
#6
Erfahrener Newbie
Registriert seit: Jul 2010
Beiträge: 111
Bedankt: 1
Ok Danke.
Der 2. Code von dir hat funktioniert.
08.07.10, 16:49
#7
Erfahrener Newbie
Registriert seit: Jul 2010
Beiträge: 111
Bedankt: 1
Ich habe esw auch schon gedownloaded und es intalliert auch gerade.
Aber Danke nochmal.
08.07.10, 16:59
#8
Erfahrener Newbie
Registriert seit: Jul 2010
Beiträge: 111
Bedankt: 1
Ok mache ich auf jeden Fall wen ich ein Problem habe.
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 19:36 Uhr.
().