Visual Studio coding

  • Coding
  • 7 Antworten
  • 1.584 Zugriffe
  • Hey,


    Ich hab mir letzens Visual Studio runtergeladen,
    jetzt habe ich einen button erstellt (Windows Forms Anwendung) und
    wollte fragen wie man das macht wenn man auf dem button Klick das
    man eine Nachricht bekommt (Msgbox).



    Mit Freundlichen Grüßen
    -Electro

  • Also Ich hab noch NIE mit Visual Studio gearbeitet.


    Also hier ist mein Kompeltes Werk.

    Inhalt anzeigen
    #pragma once

    Inhalt anzeigen

    Inhalt anzeigen
    namespace VS Test {

    Inhalt anzeigen

    Inhalt anzeigen
    using namespace System;
    using namespace System::ComponentModel;
    using namespace System::Collections;
    using namespace System::Windows::Forms;
    using namespace System::Data;
    using namespace System::Drawing;

    Inhalt anzeigen

    Inhalt anzeigen
    /// <summary>
    /// Zusammenfassung für Form1
    /// </summary>
    public ref class Form1 : public System::Windows::Forms::Form
    {
    public:
    Form1(void)
    {
    InitializeComponent();
    //
    //TODO: Konstruktorcode hier hinzufügen.
    //
    }

    Inhalt anzeigen

    Inhalt anzeigen
    protected:
    /// <summary>
    /// Verwendete Ressourcen bereinigen.
    /// </summary>
    ~Form1()
    {
    if (components)
    {
    delete components;
    }
    }

    Inhalt anzeigen

    Inhalt anzeigen
    private: System::Windows::Forms::Button^ button1;
    protected:

    Inhalt anzeigen

    Inhalt anzeigen

    Inhalt anzeigen

    Inhalt anzeigen

    Inhalt anzeigen

    Inhalt anzeigen

    Inhalt anzeigen

    Inhalt anzeigen

    Inhalt anzeigen

    Inhalt anzeigen

    Inhalt anzeigen

    Inhalt anzeigen

    Inhalt anzeigen

    Inhalt anzeigen

    Inhalt anzeigen

    Inhalt anzeigen

    Inhalt anzeigen
    private:
    /// <summary>
    /// Erforderliche Designervariable.
    /// </summary>
    System::ComponentModel::Container ^components;

    Inhalt anzeigen

    Inhalt anzeigen
    #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(Form1::typeid));
    this->button1 = (gcnew System::Windows::Forms::Button());
    this->SuspendLayout();
    //
    // button1
    //
    this->button1->Location = System::Drawing::Point(12, 12);
    this->button1->Name = L"button1";
    this->button1->Size = System::Drawing::Size(851, 282);
    this->button1->TabIndex = 1;
    this->button1->Text = L"TESTBOX";
    this->button1->UseVisualStyleBackColor = true;
    this->button1->Click += gcnew System::EventHandler(this, &Form1::button1_Click);
    //
    // Form1
    //
    this->AutoScaleDimensions = System::Drawing::SizeF(6, 13);
    this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
    this->BackgroundImage = (cli::safe_cast<System::Drawing::Image^ >(resources->GetObject(L"$this.BackgroundImage")));
    this->ClientSize = System::Drawing::Size(875, 306);
    this->Controls->Add(this->button1);
    this->Name = L"Form1";
    this->Text = L"VS Test";
    this->Load += gcnew System::EventHandler(this, &Form1::Form1_Load);
    this->ResumeLayout(false);

    Inhalt anzeigen

    Inhalt anzeigen
    }
    #pragma endregion
    private: System::Void Form1_Load(System::Object^ sender, System::EventArgs^ e) {
    }
    private: System::Void checkBox9_CheckedChanged(System::Object^ sender, System::EventArgs^ e) {
    }
    private: System::Void checkBox1_CheckedChanged(System::Object^ sender, System::EventArgs^ e) {
    }
    private: System::Void button1_Click(System::Object^ sender, System::EventArgs^ e) {
    }
    };
    }



    Und jetzt möchte ich wenn man auf TESTBOX klick eine message kommt z.b. blabla



    //edit: quelltext geht nicht

  • Zitat

    Also hier ist mein Kompeltes Werk.

    Du meinst die Vorlage.. :rolleyes:


    Das ist C++