Custom Control Reference Issue

  • Thread starter Thread starter Jason Stamp
  • Start date Start date
J

Jason Stamp

I have written 2 custom controls in VB.NET that I am referencing in a VB.NET
windows application.

The controls derive from standard .NET controls, 1 from the label and the
other from the button. I have added these to my toolbox and dragged them
into forms in my windows project.

They all work fine, but the trouble I am having is that studio occassionaly
removes the declarations of them in the windows generated code in the forms.
I can be writing code one minute, switch to the design view of a form and
the custom controls have disapeared. Then I get lots of errors saying there
is no declaration. I have to close the project without saving then open it
again to carry on, otherwise I have to add the controls in again.

When I have worked on a C# windows application, I have never had this issue.

Are there any known reasons as to why this is happening?

Thanks

Jason
 
Hi Jason,

Will you meet the same problem if using these two custom controls in a C#
application project?

If you still have this problem, I suspect there might be an internal
exception when the designer using the methods/properties on one of your
custom control,
You may try the article below to setup the debug environment for
design-time control, and enable the debugger catching the "first-chance
exception". It will give us more precise information about the error (e.g.
Exception type, message, as well as the StackTrace).
The "first-chance exception" can be enabled in Exception Dialog by
"Debug"->"Exception" in the menu, select "Common Language Runtime
exception" choose "break into...." when the exception is thrown).

To narrow down this problem, I suggest you testing these two custom control
one by one.

If you still have problem on this issue, please post the exception info
above in your reply and let me know more about your two custom controls.

Thanks!


Best regards,

Ying-Shen Yu [MSFT]
Microsoft community Support
Get Secure! - www.microsoft.com/security

This posting is provided "AS IS" with no warranties and confers no rights.
This mail should not be replied directly, please remove the word "online"
before sending mail.
 
Back
Top