c# - Visual Studio 2008 Warning About Changes to Designer-Generated Code -


This question is kind of arbitrary but still interesting to me; I was thinking that Visual Studio 2008 constant :

  public class Service101: ServiceBase  

Showing the following warning at design time:

  Warning 1 can not process code on designer line 68 : If (EventLog.SourceExists (DISPLAY_NAME)) {EventLog.CreateEventSource (DISPLAY_NAME, "app"); } The code is generated by the code designer within the 'InitializeComponent' and should not be manually modified. Please remove any changes and try to open the designer again. E: \ Proyectos \ beanstalk \ dotnetfx \ trunk \ WinSvc101 \ WinSvc101 \ Service101.cs 69 0  

Any comments would be greatly appreciated. Thanks in advance.

When you add the code to InitializeComponent (), the designer is not happy . Try doing something instead:

  Public Service101 () {InitializeComponent (); This.createEventSource (); } Private Zero start initializeComponent () {this.ServiceName = SERVICE_NAME; This.EventLog.Source = DISPLAY_NAME; This.EventLog.log = "application"; } Incidents of making zero () (if! EventLog.SourceExists (DISPLAY_NAME)) {EventLog.CreateEventSource (DISPLAY_NAME, "app");}}  

Comments

Popular posts from this blog

c# - ListView onScroll event -

PHP - get image from byte array -

Linux Terminal Problem with Non-Canonical Terminal I/O app -