Hi, I am in need of a good reference for C++/CLI. Right now I need to know how to exit the main loop of a form, such as if the user clicked the 'X' at the top right.

Nevermind, the function Close() is what I needed.

Here's a good (but not great reference/tutorial) http://www.functionx.com/vccli/index.htm

If you know what you need MSDN is the best place to find class definitions, etc.

The beauty (or some would say the bane) of .NET is that you don't have to do anything when the user clicks the X, all of that is taken care of. Now if you want something to happen when you click the X (besides the program exiting) you have to add some code to the event handler. With the Form1.h [Design] tab selected, click on your form, go over to the properties pane on the right side of the VC++ window, click on the lightning bolt, scroll down to form closing and double click the cell right next to it. That will place the even handler in your code. Check out http://msdn.microsoft.com/en-us/library/system.windows.forms.form.closing.aspx for the specifics.

Any references you find with code for .NET that are in C# can be translated to C++, knowing that in C# the . operator serves as both namespace separator and as method invocation.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.