How to... With inherited control 
Author Message
 How to... With inherited control

I'm building a test app in vb.net.
Due to the lack of rebar support, I decided to temporarily do it with an
inherited panel, one that draws the rebar look.

So I created a panel using the IDE, all fine.

Next I created a class to inherit the panel, doing this:

Public Class PanelEx
   Inherits Panel
   Protected Overrides Sub OnPaint(ByVal e As
System.WinForms.PaintEventArgs)
      MyBase.OnPaint(e)
      ......
      'Boring Drawing Stuff
      ......
   End Sub
End Class

Then I replaced the System.Winforms.Panel with PanelEx on the form code. I
run the project, all works as expected, but if I reopen the form in design
mode, I get:

"An error occured while loading the document. Fix the error, and then try to
load the document again. The error message follows:
Could not create the component 'Panel1' because the type 'PanelEx' could not
be loaded. Please make sure that the assembly that contains the type is
referenced. If this type is a part of your development project, make sure
that the project has been successfully built."

Any hints as to what I'm doing wrong? Is this a bug in Beta1?

Best Regards,

Miguel Santos



Sat, 31 May 2003 10:10:29 GMT  
 How to... With inherited control
Did you build your project?

Matthew Stoecker


Quote:
> I'm building a test app in vb.net.
> Due to the lack of rebar support, I decided to temporarily do it with an
> inherited panel, one that draws the rebar look.

> So I created a panel using the IDE, all fine.

> Next I created a class to inherit the panel, doing this:

> Public Class PanelEx
>    Inherits Panel
>    Protected Overrides Sub OnPaint(ByVal e As
> System.WinForms.PaintEventArgs)
>       MyBase.OnPaint(e)
>       ......
>       'Boring Drawing Stuff
>       ......
>    End Sub
> End Class

> Then I replaced the System.Winforms.Panel with PanelEx on the form code. I
> run the project, all works as expected, but if I reopen the form in design
> mode, I get:

> "An error occured while loading the document. Fix the error, and then try
to
> load the document again. The error message follows:
> Could not create the component 'Panel1' because the type 'PanelEx' could
not
> be loaded. Please make sure that the assembly that contains the type is
> referenced. If this type is a part of your development project, make sure
> that the project has been successfully built."

> Any hints as to what I'm doing wrong? Is this a bug in Beta1?

> Best Regards,

> Miguel Santos



Mon, 02 Jun 2003 00:11:48 GMT  
 How to... With inherited control
Hi Matthew.

Yes, I did build the project. I also tried packaging it in a different
dll/assembly/whatever, and then it does work, but I'm expecting to inherit
control in different ways according to projects, and would end up with
hundreds of dlls, so I was expecting to put the inherited control in the
same project as the form that uses it.

May I remind that running the project does work, it's just the form designer
that gives this error.

Best Regards,

Miguel Santos


Quote:
>Did you build your project?

>Matthew Stoecker



>> I'm building a test app in vb.net.
>> Due to the lack of rebar support, I decided to temporarily do it with an
>> inherited panel, one that draws the rebar look.

>> So I created a panel using the IDE, all fine.

>> Next I created a class to inherit the panel, doing this:

>> Public Class PanelEx
>>    Inherits Panel
>>    Protected Overrides Sub OnPaint(ByVal e As
>> System.WinForms.PaintEventArgs)
>>       MyBase.OnPaint(e)
>>       ......
>>       'Boring Drawing Stuff
>>       ......
>>    End Sub
>> End Class

>> Then I replaced the System.Winforms.Panel with PanelEx on the form code.
I
>> run the project, all works as expected, but if I reopen the form in
design
>> mode, I get:

>> "An error occured while loading the document. Fix the error, and then try
>to
>> load the document again. The error message follows:
>> Could not create the component 'Panel1' because the type 'PanelEx' could
>not
>> be loaded. Please make sure that the assembly that contains the type is
>> referenced. If this type is a part of your development project, make sure
>> that the project has been successfully built."

>> Any hints as to what I'm doing wrong? Is this a bug in Beta1?

>> Best Regards,

>> Miguel Santos



Mon, 02 Jun 2003 00:31:45 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. repost: How to... With inherited control

2. Controls Inheriting Other Control's Properties

3. Controls Inheriting Other Control's Properties

4. Controls Inheriting Other Control's Properties

5. Controls Inheriting Other Control's Properties

6. custom form control: Cannot view design view of forms that inherit this form

7. Tab Control in inherited forms

8. Inheriting from controls

9. Inherited form and remembering controls

10. inherited control question

11. Move controls on inherited form?

12. Inherits - TreeNode Control

 

 
Powered by phpBB® Forum Software