Top DevX Stories
Creating Custom Export Filters for StarOffice with XSLT
WPF Wonders: Using DataTemplates
Crystal Reports Family Offers Options for Developers
Avaya Aura Session Manager video
Avaya Aura Overview video
Search the forums:

Go Back   DevX.com Forums > DevX Developer Forums > .NET

Reply
 
Thread Tools Search this Thread Rate Thread Display Modes
  #1  
Old 10-26-2009, 10:01 AM
jcb1269 jcb1269 is offline
Registered User
 
Join Date: Jul 2004
Posts: 296
Question Windows Service.... :(

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
Reply With Quote
  #2  
Old 10-26-2009, 03:58 PM
joewmaki joewmaki is offline
Registered User
 
Join Date: May 2004
Location: Duluth MN
Posts: 311
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
Reply With Quote
  #3  
Old 11-16-2009, 05:11 PM
JGRobinson's Avatar
JGRobinson JGRobinson is offline
Registered User
 
Join Date: May 2004
Location: Durham, UK
Posts: 173
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
Reply With Quote
Reply

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

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


All times are GMT -4. The time now is 11:23 PM.


Sponsored Links



Acceptable Use Policy

internet.comMediabistrojusttechjobs.comGraphics.com

WebMediaBrands Corporate Info


Advertise | Newsletters | Feedback | Submit News

Legal Notices | Licensing | Permissions | Privacy Policy


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.