Trigger event.
Jan 18, 2012 at 2:48pm UTC
Hello, I'm kinda new to C++ coding, but I have experience with VB and web programming.
I made a form and after it's created I want it to trigger an event like this:
1 2 3 4
event()
{
// do things here
}
How can I make this possible?
This is my whole code, but not really important for this question.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105
#pragma once
namespace GUIWindowsFormsApplication {
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>
/// Summary for Form2
/// </summary>
public ref class Form2 : public System::Windows::Forms::Form
{
public :
Form2(void )
{
InitializeComponent();
//
//TODO: Add the constructor code here
//
}
protected :
/// <summary>
/// Clean up any resources being used.
/// </summary>
~Form2()
{
if (components)
{
delete components;
}
}
private : System::Windows::Forms::Label^ label1;
private : System::Windows::Forms::ProgressBar^ progressBar1;
private : System::Windows::Forms::Label^ TextUpdating;
protected :
private :
/// <summary>
/// Required designer variable.
/// </summary>
System::ComponentModel::Container ^components;
#pragma region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
void InitializeComponent(void )
{
this ->label1 = (gcnew System::Windows::Forms::Label());
this ->progressBar1 = (gcnew System::Windows::Forms::ProgressBar());
this ->TextUpdating = (gcnew System::Windows::Forms::Label());
this ->SuspendLayout();
//
// label1
//
this ->label1->AutoSize = true ;
this ->label1->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif" , 12, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point,
static_cast <System::Byte>(0)));
this ->label1->ForeColor = System::Drawing::SystemColors::WindowText;
this ->label1->ImageAlign = System::Drawing::ContentAlignment::TopCenter;
this ->label1->Location = System::Drawing::Point(88, 50);
this ->label1->Name = L"label1" ;
this ->label1->Size = System::Drawing::Size(324, 20);
this ->label1->TabIndex = 3;
this ->label1->Text = L"Windows 7 Home Premium is being updated." ;
//
// progressBar1
//
this ->progressBar1->Location = System::Drawing::Point(70, 125);
this ->progressBar1->Name = L"progressBar1" ;
this ->progressBar1->Size = System::Drawing::Size(360, 60);
this ->progressBar1->TabIndex = 4;
//
// TextUpdating
//
this ->TextUpdating->AutoSize = true ;
this ->TextUpdating->Location = System::Drawing::Point(68, 190);
this ->TextUpdating->Name = L"TextUpdating" ;
this ->TextUpdating->Size = System::Drawing::Size(175, 13);
this ->TextUpdating->TabIndex = 5;
this ->TextUpdating->Text = L"8888888888888888888888888888" ;
//
// Form2
//
this ->AutoScaleDimensions = System::Drawing::SizeF(6, 13);
this ->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
this ->ClientSize = System::Drawing::Size(484, 262);
this ->Controls->Add(this ->TextUpdating);
this ->Controls->Add(this ->progressBar1);
this ->Controls->Add(this ->label1);
this ->Name = L"Form2" ;
this ->ResumeLayout(false );
this ->PerformLayout();
}
#pragma endregion
};
}
And as last question what is the difference between class, int, bool and such? Like in:
1 2 3
class event()
int event()
bool event()
Thanks a lot!
Hans
Last edited on Jan 18, 2012 at 2:48pm UTC
Jan 18, 2012 at 3:27pm UTC
This is C++/CLI. Although the forum descriptions might state that you can ask C++/CLI questions here, the truth is that most of us don't know C++/CLI. By all means feel free to hang out here, but be forewarned: Your CLI questions might go unanswered.
My honest advise: Post your CLI questions @ the MSDN forums.
Topic archived. No new replies allowed.