Actually I have a lot more questions than this about this application that I'm working on, but this will at least get me started.

I'm trying to get my app to look for a specific filename (C:\test.txt) we'll say. Every 100ms. Once the file exists, I want to run a ReadAllText on it and then delete the file.

Can someone help me with the syntax for that?

Thanks a bunch in advance!

First off if you want to run it on a timer use the timer control, then set the interval to 100ms and call the code that looks for the file in the timer event.

Try that out and get back to me with what you come up with.

Cheers

D

Ok, here's what I have so far

Public Class Form1
    Dim RunningTime As Integer = My.Computer.FileSystem.ReadAllText("C:\data.dat") 'need if/then to start countdown if value in data.dat is numeric, pause timer if value is PAUSE, and resume timer if value is RESUME. Right now it assumes the value is numeric and starts the countdown.

    Private alarmTime As Date

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Me.alarmTime = Date.Now.AddSeconds(RunningTime)
        Me.Timer1.Start()
    End Sub

    Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
        If alarmTime < Date.Now Then
            Me.Timer1.Stop()
            Me.Close()
        Else
            Dim remainingTime As TimeSpan = Me.alarmTime.Subtract(Date.Now)

            Me.TextBox1.Text = String.Format("{0:d2}:{1:d2}:{2:d2}:{3:d3}", _
                                           remainingTime.Hours, _
                                           remainingTime.Minutes, _
                                           remainingTime.Seconds, _
                                           remainingTime.Milliseconds)
        End If
    End Sub


    Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged

    End Sub
End Class

The notation on line 2 explains what I'm trying to do.

Thanks in advance.

That looks like VB.Net code, I think you need to get over there to get those guys to answer, or better yet get a mod to move this one.

Sorry, but if I get it wrong it won't help you any :)

Whoops! Indeed it is, sorry, I didn't even notice I was in the wrong forum!

This article has been dead for over six months. Start a new discussion instead.