I have written a windows service which I am trying to call a public method from. I have referenced the .dll which contains the method and I am able to see it from within the code.
Public Sub DoNextExecution()
SyncLock Me
timer.Stop()
EventLog.WriteEntry("Automated service started")
MyClass.AutomatedService()
EventLog.WriteEntry("Automated service finished")
timer.Start()
End SyncLock
End Sub
The code runs to this point fine, but when executing the code ‘MyClass.AutomatedService()’ it hangs and does not proceed any further. AutomatedService is the method which I am trying to call. I have declared ‘MyClass’ as the following;
Dim MyClass As MyProject.MyClass
Is it possible to actually call a method in this way? or am I heading in the totally wrong direction?
Thanks in advance.
Dim MyClass As MyProject.MyClassMyClass will always
NULLand you are trying to insansiate a method on the class where it’snullcausing an exception which will then jump over theEventLog.WriteEntry("Automated service finished")will not show because the exception will not be caught.