Click to See Complete Forum and Search --> : Newbie Question


Arend
January 9th, 2007, 06:49 PM
I am new to VC++ 2005 (years ago I did do some c++ programming) and have a simple question.

I created a CLR project with a Windows form and added a button to the form. When clicking the button in the IDE the event handler goes into the .H file and not the .CPP file. Is this correct?

I was under the impression that the .H header file was just that, for headers and not for general code.

Please can somebody put me right on this as I have read numerous web pages on the Microsoft site and also viewed the help which is included with Visual Studio 2005 but to no avail. I am fairly familiar with VB .NET which seems to be childs play compared to VC++.

Regards

Arend

"Happyness is linked to expectations, if you want to be happier lower your expectations."

cikastef
January 9th, 2007, 11:48 PM
I guess you mean that the event handler goes to Form1.h which is the default location for auto-generated code. Implement the event function in .cpp file and the program will go there. Make that function that was created for you, just the definition.e.g. without {} and with ; in the .h file
I hope that helps you.

cilu
January 10th, 2007, 04:25 AM
When clicking the button in the IDE the event handler goes into the .H file and not the .CPP file. Is this correct?
Yes, it is correct. That is how it was implemented, because it needed to be a cross-language feature, and in C# and VB.NET there isn't a separation between definition and declaration. I remember the question was answered by the Microsoft guys in the slow chat forum, several months ago.

Arend
January 10th, 2007, 04:37 AM
Thank you cikastef,

I new about this, but the whole function is put into the .h file including {} and ;.

Also thank you silu,

I will have a look in the 'slow chat forum'. Does this mean that the implementation code goes there as well?


Thank you both for your replies, I am very grateful.

Arend