Error : The service System.Windows.Forms.Design.IEventHandlerService already exists in the service container Error : The service System.Windows.Forms.Design.IEventHandlerService already exists in the service container xml xml

Error : The service System.Windows.Forms.Design.IEventHandlerService already exists in the service container


I just ran into this problem myself. According to another webpage, this error can be fixed by closing visual studio and deleting your obj folder, and then re-opening visual studio and doing a project re-build.

Here's the page I read it from. http://www.csharp411.com/ieventhandlerservice-already-exists-in-the-service-container/

They said to delete the bin folder too but I found that I didnt have to do that. Hope this helps!


This worked for me although I'd still like to better understand what was going wrong. I was creating an inherited form in Visual Studio. Apparently the Visual Studio designer calls the Load function before displaying the form. The load function in the parent window was being called and accessing a control on the form, this was throwing an object reference not set to an instance of an object (why?).

The solution for me was to add the following line of code at the beginning of the parent forms load function. I am using VB but it is similar for C#.

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load    If (DesignMode) Then Exit Sub


Check whether some event is going to call at opening or closing even of that specific form , and once you identify that event simply past the following statement . Hopefully it will work for you.

If (DesignMode) Then Exit Sub