Dark Bit Factory & Gravity

PROGRAMMING => C / C++ /C# => Topic started by: daantje on January 24, 2012

Title: C++ form events in microsoft visual c++ 2010 express
Post by: daantje on January 24, 2012
Hello,

I have some problems using microsoft visual, i recently started using this but when i make a form, and add a event to, say a button, i can't delete it anymore.
The problem is in the line that start with "Private: system..", it's like an execution for what will happen if i click on the button for example. But when i want to delete the line because it takes space and it's of no use anymore, the program will give an error when starting the program again. But before I added the line for the event there was nothing there so what's the harm in me deleting it again?
A solution or explanation would be very nice,

Daan
Title: Re: C++ form events in microsoft visual c++ 2010 express
Post by: LittleWhite on January 24, 2012
Hello,

I never used the Designer for C++ (only C#). Can you show us the code generated and causing problem ?
I guess the Designer is parsing the C++ to search for some elements ... and if not present, crashing ?  ???
Title: Re: C++ form events in microsoft visual c++ 2010 express
Post by: Jim on January 24, 2012
Do you mean it just won't compile?
When you double click the button in the designer to add the callback method, VS adds a method to your Form class AND it adds the event handler to the code in the designer.  You need to remove both.
You can do that manually or, in the designer, next to where you set the button properties, you can select the list of event handlers, and blank out the one that points to the automatically generated method.

Jim
Title: Re: C++ form events in microsoft visual c++ 2010 express
Post by: krisp on January 25, 2012
Use the form designer to delete buttons etc. This deletes the auto-generated code too.

Kris