StrataFrame Forum

Changing controls to Base Classes

http://forum.strataframe.net/Topic25359.aspx

By Ger Cannoll - 12/9/2009

Is it possible to change classes easily on exisitng forms. I have a no. of forms set up with SF classes and now want to change these forms to use my own base classes.

Now that I feel comfortable with my Base Classes, I want to go back over any forms that have been done and change the class the controls are based on.

 (e.g. for TextBoxes, ChkBoxes,Tabs etc). IN VFP, I used to do this by going behind the scenes and editing the .scx file...just wondering if there is something similar in VS.

By Greg McGuffey - 12/9/2009

The same sort of thing is found in each form's .Designer file. This file has the declarations for all the controls uses on the form. At the very bottom, it declares a bunch of fields, one for each control. Then at the top of the InitializeComponent() method, it instantiates each of these fields. You need to replace the existing SF types with your own types. There are a couple of ways to get this done:



1. Open the designer file, go to the end of the file. Look for control fields that need to be updated and update them. Then look to see what errors now exist, click on errors to go to the line that instantiates the field and fix those.

2. Use Find and Replace. You could do this across the entire solution or just open each designer file individually. I'd definitely verify each replace.



I'd suggest you use method one on one or two designer files until you understand what you're doing, then let 'er rip with find and replace! BigGrin
By Ger Cannoll - 12/9/2009

Hi Greg.. thanks for your very informative reply.

I'll check that out and note your comments about proceeding with caution !!