windows app in CLR

i have a difficulties in CLR's, how to use "click" event? i have like this:

1
2
3
4
5
6
7
8
#pragma endregion //btw, can anyone explain to me what pragma's doin'?
	private: System::Void btn_result_Click(System::Object^ sender, System::EventArgs^ e) {
			int i, j, k;
			i = Int32::Parse (textBox1->Text);
			j = Int32::Parse (textBox2->Text);
			k = i + j;
			textBox3->Text = k.ToString();
		}


but it doesn't works... am i doin' somethin' wrong?
closed account (z05DSL3A)
In what way does it not work?


P.S.
The pragma is to to with code folding in the editor. You should have coresponding #pragma region [some lable text here] and a small box with a minus sign, if you click that the code between the pragmas is hidden
the "Click" event doesn't appear the result in "textBox3". it just didn't work...

edit: i just try it again but by double-click the button in design mode and add the code above:
1
2
3
4
5
			int i, j, k;
			i = Int32::Parse (textBox1->Text);
			j = Int32::Parse (textBox2->Text);
			k = i + j;
			textBox3->Text = k.ToString();

and it work... but i don't understand, i try it before with exact same code (i press F7 to edit the code, not double-click the button picture in design mode) but it didn't work. really strange...
Last edited on
It is not strange at all. By double-clicking, you invoked the default event writer in Visual Studio, which writes code in the designer that links the function btn_result_Click() to the click event of the control. If you just write the event in the form class but don't explicitly link it to the event, then it is never invoked.
Topic archived. No new replies allowed.