You must Sign In to post a response.
  • Category: Windows

    Derived control without designer

    Are you looking for a way to Derived control without designer in windows form ? then read this thred to know more about it

    I am working on a windows application and it has a control library which has controls that derive from the existing windows controls. for eg, there is a textbox control that derives form the standard windows.forms.controls.textbox.
    There are other controls that derive from various other windows controls similar to this.But I see that many of them dont have a .designer.cs file. some of them only have .cs file and some of them .cs and .resx files. Can anyone please explain to me how these would have been created and what is the advantage of not having a designer file?
  • #719806
    Hi Bhuvaneswari.
    A .designer.cs file is created automatically by the system when you add labels, textboxes, panels etc in the form. Any type of design changes are captured in the designer.cs file.
    On the other hand, .cs file is a code file having the class declaration. This file needs to be compiled before executing the application to get the result.



  • #719812
    If the file contains Visual element just like a form then it will have a designer file.

    if the file is only dealing with the code then there is no need to have the designer file.

    may the files dont have a visual thing thats why it have only a code and a resource file.

    or else search some other Folder if there is any.

    Thanks & Regards
    Anil Kumar Pandey
    Microsoft MVP, DNS MVM

  • #719821
    Thanks for your reply.I am aware of the difference between a designer file and code file. But my question is how are these files created without a designer file? When we view the files in solution explorer, we can see that different icons are used to indicate different types of files. For eg, when it a class we will have a c# icon, for forms we will have a form icon. But in my case these files have a icon similar to that of a component class but none of them have a designer file. I tried creating a component and it adds a designer file automatically.(I have not added any control into it). When I try and delete the designer file, the file becomes a normal class file. That's why I have the doubt as how these files would have been created without a designer file but still solution explorer shows them as similar to component files. And remember that these files are in a control library and not in windows forms project, so no visual elements here.

  • #719837
    Hi Bhuvaneswari,

    Can you please post a screen print.
    .Designer.cs is an auto-generated code created by the windows forms designer when you drop a control.

    If you post the screen print we may be able to have a quick look on that to see what is happening.

    Asheej T K

  • #719840
    I cannot post a screen print due to some restiction in my office. The custom controls I am speaking about are all definitely componenents as they show up in the toolbox as components. When we add a new component, it gets created with a designer file by default and it can't be deleted as VS throws error. Then how can the custom components would have been created without a designer file? This is my question.

  • This thread is locked for new responses. Please post your comments and questions as a separate thread.
    If required, refer to the URL of this page in your new post.