|
#1
|
|||
|
|||
|
I have code in my OnStart and OnStop routines. The code only runs one time. How do I keep it running? I'm trying to monitor a directory, if a certain file is created there I want it to proccess the file. Currently it processes the file one time and then not again. I'm doing something like this:
---OnStart--- Timer1.Start() 'Get the file to read Dim sFile As String = My.Resources.File1.ToString Dim instance As FileSystemWatcher instance.Path = "C:\Misc" If File.Exists(sFile) Then 'Adds records from file to database. Call ProcessTextFile() End If This happens only one time. I thought as a service it would just keep checking for the file and process accordingly. Any help would be great!!! Thanks all. jb |
|
#2
|
|||
|
|||
|
Which version of VB.Net are you using. Did you check out the help files Walkthrough...
Creating a Windows Service Application in the Component Designer (VS 2008). You might look at using the FileSystemWatcher component and using the associated events to handle your file processing. Also check out the WaitForChange method... How to: Wait Until Specified File System Events Occur
__________________
...joe |
|
#3
|
||||
|
||||
|
This looks quite a good thread to have a look at http://forums.asp.net/t/1438769.aspx
__________________
Hope this helps Graham Before you criticize someone, you should walk a mile in their shoes. That way, when you criticize them, and if they get mad, you are a mile away and you have their shoes ;-) http://programmingtips.co.uk |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Asp.net Tab missing in IIS 5 | eriveraa | ASP.NET | 1 | 06-17-2008 11:52 PM |
| Using Java 6SE to query a web service | (MC3)RaVeN | Java | 0 | 03-02-2007 10:30 AM |
| Windows Service Class - Exception when installing | Filip | .NET | 2 | 06-12-2002 06:08 AM |
| Can you call an .EXE from a windows service? | mark erickson | .NET | 2 | 05-28-2002 12:38 PM |
| Web Service to Windows Forms communication HELP!? | rick | .NET | 1 | 10-21-2001 11:22 PM |