Saturday, 15 March 2014

How to use Objects in Windows Forms C++ -


I have a Windows Forms program with "Connect" and "Disconnect" buttons.

When the connect-button is clicked, the object of my own class should be created:

  Private: System :: Zero Connect Tag (System :: Object Sender, System :: EventArgs ^ e) {my_class new_object (); Return; }   

After clicking on the Connect button, Disconnect-button is enabled and the object must be removed:

  Private: System :: Zero Disconnect_Click (System :: Object ^ Sender, System :: EventArgues ^ E) {// Delete new_object return; }   

The problem is, I really do not know how I can remove my objekt from any other method. How can I deliver new_object to disconnect method?

To be able to get any variable from multiple operators, you have to create those variables global .

In addition, objects have also been deleted and are not using Delete operators.

In addition to this it is a bad habit which is clearly calling the destroyer. In your case, if you call it a program, it will crash in the form of execution, the compiler will again call the constellations for all the objects and will try to free you completely free memory.

No comments:

Post a Comment