Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why does my class suddenly have a 'designer'?

I just finished adding and removing different database models (I was trying to figure out which one I should be using for this project) then after playing around for a while I noticed one of my classes's icon changed from what is shows beside my Calculations.cs class in the first image to the Balance.cs icon.

enter image description here

The Balance.cs now has this Designer component so when I double click on it I see my second screen shot. This seems to be allowing me to add components from the toolbox to my class. There are actually two classes within my Balance.cs. This Designer thing is only affecting/interacting with one of them (it inherits from SerialPort).

enter image description here

I don't really know what changed or what I did to make this happen and ctrl+z is not being my friend here. How do I change Balance.cs back to a regular class with no designer component?

Thanks

like image 783
Brad Avatar asked Aug 31 '25 20:08

Brad


1 Answers

If any of the classes in a source file inherit - either directly or indirectly - from System.ComponentModel.Component (such as SerialPort), Visual Studio will provide design-time support to you. This is sometimes unwanted behaviour, and you can safely ignore it in most cases.

If it really bothers you, you can decorate your class with the [DesignerCategory] attribute (set the category to an empty string).

like image 134
Bradley Smith Avatar answered Sep 03 '25 10:09

Bradley Smith