Changing the parent class of controls already on a form


Author
Message
Charles R Hankey
Charles R Hankey
Advanced StrataFrame User (922 reputation)Advanced StrataFrame User (922 reputation)Advanced StrataFrame User (922 reputation)Advanced StrataFrame User (922 reputation)Advanced StrataFrame User (922 reputation)Advanced StrataFrame User (922 reputation)Advanced StrataFrame User (922 reputation)Advanced StrataFrame User (922 reputation)Advanced StrataFrame User (922 reputation)
Group: Forum Members
Posts: 524, Visits: 30K
Another of my "aha" moments as I crawl up the learning curve of .NET.



I'm sure this is glaringly obvious to most of you, and I know it isn't rocket science, but I want to make this observation for benefit of form VFP developers like myself who cut our teeth on inheritance and subclassing issues there :



Not only can you change the parent class of an object after it is created with no difficulty ( e.g. creating a business object baseclass subclassed from the SF one, then going into your own previously created BOs and just changing the Inherits line.) but you can change the parent class of controls that are already on a form by just hacking the designer page.



Recently had a form with 12 datagridviews, decided to create my own subclass of datagridview in my UI library. First instinct was to blow away the 12 dgvs I had and drop on my new dgvs - then stopped thinking Fox, started thinking .NET and poked around on designer page, found the lines that defined the dgvs as New System.Windows.Forms.DataGridView and changed it to New CRH.UI.dgv



OK, maybe everybody else knows that but I thought it was cool and maybe there is one other person who hadn't tried that before. Can really come in handy if you need to change the parent of 100 textboxes. Smile



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