Good answer by SAKryukov. Want to add some to it.
If you simply want to check if an Object is a derived of another you can do the following:
QTextBox qtb = new QTextBox();
TextBox tb = qtb as TextBox;
if (tb == null)
{
}
else
{
}
Edit:
I have used the
"as" operator[
^]. The "as" operator is equal to TryCast in VB, which describes it pretty well I think. Follow the link for an example and short description "The as operator is used to perform certain types of conversions between compatible reference types. The as operator is like a cast operation. However, if the conversion is not possible, as returns null instead of raising an exception.".