Jump to content
  • Advertisement
Sign in to follow this  

[.net] Bug in VS .Net? (properties on custom controls)

This topic is 5481 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I was wondering if this is a bug in Visual Studio.Net, or an oversight on my part. I've gotten to understand the conditions to the point where I can easily repeat it. Try the following: 1. Make a new Windows forms controls project (I've tested this in C# and MC++). Remove the default controls and add a new c++ header and cpp file if in MC++, or a new class file if in C#. 2. Make the control inherit from TextBox. Leave everything alone, but add a simple custom property. For example, call a private int x, and make a public property called X. 3. Build this control, then close the project and create a new Windows forms project in MC++. The bug does not appear to happen when using C# for the form. 4. In the new forms project, add a few controls. Then add the new custom textbox from above. 5. Switch to the code view. You'll notice that a new member has been added to the Windows Form for the custom textbox, but it never gets instantiated and NO code exists for it in the initcomponent() method. 6. Now go back to design mode, and change the value of Text on the custom textbox. If you go back to design mode, ALL of the code will get erased! In addition, if you were to switch to events and add an event handler in design mode, it won't take you to code mode automatically and it won't add the event to the form. 7. If you try recreating the textbox control and comment out the custom property, everything will be fine. So, is this a bug or is there something I'm not doing to get the custom property to work correctly?

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!