Does anybody here know how to make a form with inheritance from another
class?
I tried the following:
namespace zzz
{
/// <summary>
/// Summary description for Form1.
/// </summary>
public class frmInitial : BaseForm
{
And in the baseform:
namespace yyy.Controls
{
/// <summary>
/// Summary description for BaseForm.
/// </summary>
public class BaseForm : System.Windows.Forms.Form
{
But when I open the designer, it returns an error.
Any help?
Thank you.
Anderson Kubota
Unfortunately, the VS.NET Form Designer apparently can't handle the drawing
of forms that are not directly inherited from System.Windows.Forms.Form.
My workaround is to let the form inherit from System.Windows.Forms.Form at
design time, and then switch the code to have it inherit from your base form
just before compile time. It's not an ideal solution, but it works just
fine. I also wrote a macro that will automatically modify the code
automatically. Check out this post for details:
http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&oe=UTF-8&safe=off&threadm
=%23lDgohjxCHA.2604%40TK2MSFTNGP12&rnum=12&prev=/groups%3Fnum%3D20%26hl%3Den
%26lr%3D%26ie%3DUTF-8%26oe%3DUTF-8%26safe%3Doff%26q%3Dauthor%253Aluke%40mara
thondata.com%2BOR%2Bauthor%253Aluke%40NOSPAMmarathondata.com
(Don't forget to copy and paste the entire URL into your browser, since
clicking the link probably won't grab the whole thing.)
Luke
"Anderson Takemitsu Kubota" <ander...@br.inter.net> wrote in message
news:e03LjOe...@TK2MSFTNGP09.phx.gbl...
"Neelima Godugu" <gnee...@hotmail.com> wrote in message
news:uuyH#We2CH...@TK2MSFTNGP10.phx.gbl...
The .netcf form designer doesn't support designing forms that inherit from
subclasses of Form. To work around this you can do something like this
#if designing
public class myForm : Form
#else
public class myForm : myFormSubclass
#endif
Thanks,
David
This posting is provided "AS IS" with no warranties, and confers no rights.
Thank you.
Anderson
"David So [MS]" <davi...@microsoft.com> wrote in message
news:2LSG18F3CHA.1684@cpmsftngxa06...
You will need to add this conditional compilation constant (‘designing’)
using your project properties, selecting Configuration Properties / Build /
Conditional Compilation Constants inside VS.NET.
Baccarin.
"Anderson Takemitsu Kubota" <ander...@br.inter.net> escreveu na mensagem
news:O6XxnmN3...@TK2MSFTNGP09.phx.gbl...
Anderson
"Baccarin" <pe...@pekus.com.br> wrote in message
news:#GBIZCg3...@TK2MSFTNGP12.phx.gbl...
The following steps would be what's need to get designer support and
inherited form supported in runtime.
1. Bring up the configuration manager by select it from the configuration
drop down in IDE. (It contains Debug, Release, etc.)
2. Select <New> and create a configuration as "Design", you can copy the
settings from the "Debug" configuration.
3. Bring up the project property page and make sure the "Design"
configuration is selected in "Configuration" drop down.
4. Put the compliation constant "DESIGN" into "Conditional Compilation
Constant" together with DEBUG; TRACE;
5. Close the designer.
6. Place the following code in the inherited form
#if DESIGN
public class Form2 : System.Windows.Forms.Form
#else
public class Form2 : Form1
#endif
7. When switch to design mode, make sure the "Design" configuration is set.
8. When deploy/debug/run to device, make sure the "Debug" or "Release"
configuration is set or else you form will not be an inherited form.
This will allows you to easily switch between "Designer Support" and
"Runtime support" for inherited forms.
Note:
The designer support would only means you can add control to the inherited
form but you will not see inherited control from it's parent form.
Add the "designing" compilation constant next to the DEBUG;TRACE
and this should allow you to have design time support and inherit form
support in runtime.
Your explanation was perfect. It couldn't be better.
This will be very helpful.
Thank you very much.
Anderson Kubota
"David So [MSFT]" <davi...@microsoft.com> wrote in message
news:zWMFapr3...@cpmsftngxa08.phx.gbl...