Author Topic: C++ form events in microsoft visual c++ 2010 express  (Read 3117 times)

0 Members and 1 Guest are viewing this topic.

Offline daantje

  • ZX 81
  • *
  • Posts: 9
  • Karma: 0
    • View Profile
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

Offline LittleWhite

  • Senior Member
  • Amiga 1200
  • ********
  • Posts: 418
  • Karma: 31
  • It's me!
    • View Profile
Re: C++ form events in microsoft visual c++ 2010 express
« Reply #1 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 ?  ???
The demoscene will never die, never!

Offline Jim

  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 5301
  • Karma: 402
    • View Profile
Re: C++ form events in microsoft visual c++ 2010 express
« Reply #2 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
Challenge Trophies Won:

Offline krisp

  • ZX 81
  • *
  • Posts: 4
  • Karma: 2
    • View Profile
Re: C++ form events in microsoft visual c++ 2010 express
« Reply #3 on: January 25, 2012 »
Use the form designer to delete buttons etc. This deletes the auto-generated code too.

Kris