Handling Form Inheritance


Author
Message
Thomas Holste
Thomas Holste
StrataFrame User (360 reputation)StrataFrame User (360 reputation)StrataFrame User (360 reputation)StrataFrame User (360 reputation)StrataFrame User (360 reputation)StrataFrame User (360 reputation)StrataFrame User (360 reputation)StrataFrame User (360 reputation)StrataFrame User (360 reputation)
Group: StrataFrame Users
Posts: 144, Visits: 618
Hi there,

I am going to set up the forms I will be using in my project, encountered some problems, solved them and would like to ask you, if my way will work or if there are pitfalls I have not seen yet.

I made a baseform ("MyBaseFRM") which inherits from the strataframe-standardform. There is a themed panel on it and the form has some properties and methods all forms will have. I created new forms by selecting "New Item/Windows-Form/Inherited Form" (I hope this is right translated, I use a german version of VS2010).

Then I created a form, let's name it "MySimplegridFRM" which inherits from "MyBaseFRM" and thought, I could create Forms from this Inherited Form the same way to. But this does not work.

Setting up a new form by choosing any kind of form and setting the inheritance-statement did not work too. Or creating a class which inherits from "MySimpleGridFRM".

Finally I ended up creating templates. I made a template from my "MySimpleGridFRM" and now everything works fine. I tested adding some properties in "MyBaseFRM" and could see that this changes were reflected in the inherited "MySimpleGridFRM". So everything works like I expected it to be but as I am new to inheritance in VB. I would like to ask you if this will work or if there are things I have not considered yet. I should add that all the forms I will need will inherit from "MyBaseFRM", "deeper" inheritance is not needed for my forms.

Thanks in Advance

Thomas

Ivan George Borges
Ivan George Borges
Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)
Group: StrataFrame MVPs
Posts: 1.9K, Visits: 21K
Hi Thomas.

Yep, this is the way to go.

I have a BaseForm that inherits from StrataFrame StandardForm and I have an item template inheriting from it. I also have a MaintenanceForm that inherits from MY BaseForm and I also have an item template that inherits from it.

Another thing you should consider is to have a BaseBO that inherits from MicroFour.StrataFrame.Business.BusinessLayer and then I also have an item template that inherits from my BaseBO.


Thomas Holste
Thomas Holste
StrataFrame User (360 reputation)StrataFrame User (360 reputation)StrataFrame User (360 reputation)StrataFrame User (360 reputation)StrataFrame User (360 reputation)StrataFrame User (360 reputation)StrataFrame User (360 reputation)StrataFrame User (360 reputation)StrataFrame User (360 reputation)
Group: StrataFrame Users
Posts: 144, Visits: 618
Hi Ivan,

thanks for your reply. What is the advantage of subclassing a business-object?

What kind of additions or modifications have you made with this base-BO-class?

I have not done so much with BOs except dropping them on a form and being happy how easy everything works.

Best regards

Thomas

Ivan George Borges
Ivan George Borges
Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)
Group: StrataFrame MVPs
Posts: 1.9K, Visits: 21K
Yes, dropping them on the forms will work great, but with time you could start thinking about having a generic fill method, or a rule that all BOs should follow, you might need a new property that all BOs should have so you could set different states, a generic SetDefaultValues so if all your tables have a CreatedBy column, then all BOs would generate the content for this column without you having to set it to every BO you create. There are many possibilities, so I guess it is worth starting this way at this point of your developing stage.
Thomas Holste
Thomas Holste
StrataFrame User (360 reputation)StrataFrame User (360 reputation)StrataFrame User (360 reputation)StrataFrame User (360 reputation)StrataFrame User (360 reputation)StrataFrame User (360 reputation)StrataFrame User (360 reputation)StrataFrame User (360 reputation)StrataFrame User (360 reputation)
Group: StrataFrame Users
Posts: 144, Visits: 618
Hi Ivan,

thank you for showing me the possibilities. I will try to subclass a BO and see if I can make it run. Les Pinter has an example on subclassing a BO on his website (that is where I discovered Strataframe) I will try to follow.

Best regards

Thomas

Ivan George Borges
Ivan George Borges
Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)
Group: StrataFrame MVPs
Posts: 1.9K, Visits: 21K
You're welcome, Thomas. Wink
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search