if (ParentForm == null && UIControl.Name == "") { CheckActiveForm = false; }to:
if (ParentForm == null) { if (UIControl.Name == "") { CheckActiveForm = false; } else if (UIControl.Name == UIControl.GetType().Name) { CheckActiveForm = false; } }This fixed the problem. It also introduces a bug/feature where no instance of a control can have the same name as it's class. This is good practice anyway, I guess...