Form inheritance - how is it achieved?


Author
Message
Peter Jones
Peter Jones
StrataFrame VIP (2.1K reputation)StrataFrame VIP (2.1K reputation)StrataFrame VIP (2.1K reputation)StrataFrame VIP (2.1K reputation)StrataFrame VIP (2.1K reputation)StrataFrame VIP (2.1K reputation)StrataFrame VIP (2.1K reputation)StrataFrame VIP (2.1K reputation)StrataFrame VIP (2.1K reputation)
Group: Forum Members
Posts: 386, Visits: 2.1K
Hi,

I was hoping I could create a "base" SF Maintenance form that will contain standard code and components, e.g. DefaultLookAndFeel, then inherit this form whenever I create a new form. I have my base form called frmBase_01 and, the code in my test form that is trying use the base form is:

Public Class frmBase_02
   Inherits TMS_Test_01.frmBase_01
End Class

 This generate the error:
"Error 1 Base class 'frmBase_01' specified for class 'frmBase_02' cannot be different from the base class 'MicroFour.StrataFrame.UI.Windows.Forms.StandardForm' of one of its other partial types. C:\Documents and Settings\pmj\My Documents\Visual Studio 2005\Projects\TMS_Test_01\TMS_Test_01\frmBase_02.vb"

Try as I may I just can't stumble my way past this error - can you please point me in the right direction. The recent work I've done with creating a "base" BO class works great but I notice that, for forms, the inheritence is in the partial class - I guess this is a fundemental difference that stops my base BO approach working when trying to achieve the same outcome for a form.

Cheers, Peter

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

Ah, maybe the penny just dropped for me. Is what I should be doing is creating the form that I want then simply copying the designer code from that form into my new template code? If this is the case I can see I need to use the variable $safeitemname$ in a few spots and change the vstemplate file to my new name but what about the resx file - do I need to worry about changing anything there?

That is it, the $safeitemname$ is already going to be in the template you unzipped. As for the "vstemplate" file, I think you might have to add a reference to your project, and I had to create a Strong Name Key to my "_base" project to reference there, think that the guys will tell you more about this. The resx file will need to be changed if you inserted anything in your form as an icon, or something like that, then I expect that your resx file template will need to have that too.

I use MyTemplate01 as the base for my forms and, in six months time, find that I missed a facility that I need in all forms then I have to go back and recreate all my forms using the an updated version of MyTemplate01.

How have you created your form template? I, first of all, subclassed the SF StandardForm :

Partial Public Class $safeitemname$

Inherits MicroFour.StrataFrame.UI.Windows.Forms.StandardForm

So, this is what my PFNStandardForm starts with.

Then, my maintenance form template will inherit from this PFNStandardForm, which will be PFNMaintenanceForm:

Partial Public Class $safeitemname$

Inherits ProFilmeNET_Base.UI.Windows.Forms.PFNStandardForm

This way, it is possible to add code to the PFNStandardForm in the future, and have all my maintenance forms already created inherit the changes. I hope... Hehe

Have a great Easter.

Trent Taylor
Trent Taylor
StrataFrame Developer (38K reputation)StrataFrame Developer (38K reputation)StrataFrame Developer (38K reputation)StrataFrame Developer (38K reputation)StrataFrame Developer (38K reputation)StrataFrame Developer (38K reputation)StrataFrame Developer (38K reputation)StrataFrame Developer (38K reputation)StrataFrame Developer (38K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 7K
Hi Peter,

It looks like the light came on in your last post w00t.  There is not much to add to Ivan's post...he is exactly right.  Let us know if you have any troubles. 

GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Threaded View
Threaded View
Peter Jones - 19 Years Ago
Ivan George Borges - 19 Years Ago
Trent L. Taylor - 19 Years Ago
Greg McGuffey - 19 Years Ago
Trent L. Taylor - 19 Years Ago
Greg McGuffey - 19 Years Ago
Peter Jones - 19 Years Ago
Peter Jones - 19 Years Ago
Ivan George Borges - 19 Years Ago
Trent L. Taylor - 19 Years Ago
Greg McGuffey - 19 Years Ago
Peter Jones - 19 Years Ago
Ivan George Borges - 19 Years Ago
StrataFrame Team - 19 Years Ago
StrataFrame Team - 19 Years Ago
                         One last thing... there's an Export Template Wizard that can be...
StrataFrame Team - 19 Years Ago
Peter Jones - 19 Years Ago
             Hey Peter. Glad to hear that. ;)
Ivan George Borges - 19 Years Ago

Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search