G
Guest
// there are 2 forms inheriting from EditorTemplate
// ItemsEditor and CategoriesEditor
public EditorTemplate CreateForm(string inheritedFormName)
{
// EditorTemplate editor; // makes editor in scope, but not instanstiated.
if (inheritedFormName == "Categories")
CategoriesEditor editor = new CategoriesEditor();
else if (inheritedFormName == "Items")
ItemsEditor editor = new ItemsEditor();
return editor; // IDE says this is not defined within scope.
}
How do I cast up? to the inheriting forms?
// ItemsEditor and CategoriesEditor
public EditorTemplate CreateForm(string inheritedFormName)
{
// EditorTemplate editor; // makes editor in scope, but not instanstiated.
if (inheritedFormName == "Categories")
CategoriesEditor editor = new CategoriesEditor();
else if (inheritedFormName == "Items")
ItemsEditor editor = new ItemsEditor();
return editor; // IDE says this is not defined within scope.
}
How do I cast up? to the inheriting forms?