Check whether the Control is a Button in c++/cli

c++-cli

Solution

You can use `GetType()` and `typeid` for this:

if (c->GetType() == Button::typeid) { /* ... */ }

Problem

How can I check whether the Control^ is a Button^ in the following code? ``` System::Void DisableControls(Control ^parent) { for each (Control^ c in parent->Controls) { if(c== /*Check for Button*/) { //Do something } } } ```

Original source