Regression
IS-IT--Management
Hello All,
I am writing a program that writes a line of text to a text file. I have another program(3rd Party) that checks the text file for the entered line of text. It then executes a process based on the text it finds in the text file.
The problem I am having is that my program must write to the file wait for the other program to read the file and execute its processes then clear the file.
My question for you all is is there a way to make my vb program wait until the file is not locked by the other process to open it and clear the file?
Private Sub Command1_Click()
Dim Tmp As String
Tmp = Text1.Text
Open "C:\testing.txt" For Output As #1
Print #1, Tmp
Close #1
Sleep (500)
Text1.Text = ""
Tmp = Text1.Text
Open "C:\testing.txt" For Output As #1
Print #1, Tmp
Close #1
End Sub
The code I am working with looks like this.
Private Sub Command1_Click()
Dim Tmp As String
Tmp = Text1.Text
Open "C:\testing.txt" For Output As #1
Print #1, Tmp
Close #1
' I would like to eliminate this time pause for a wait for file ready pause.
Sleep (500)
Text1.Text = ""
Tmp = Text1.Text
Open "C:\testing.txt" For Output As #1
Print #1, Tmp
Close #1
End Sub
Thanks
I am writing a program that writes a line of text to a text file. I have another program(3rd Party) that checks the text file for the entered line of text. It then executes a process based on the text it finds in the text file.
The problem I am having is that my program must write to the file wait for the other program to read the file and execute its processes then clear the file.
My question for you all is is there a way to make my vb program wait until the file is not locked by the other process to open it and clear the file?
Private Sub Command1_Click()
Dim Tmp As String
Tmp = Text1.Text
Open "C:\testing.txt" For Output As #1
Print #1, Tmp
Close #1
Sleep (500)
Text1.Text = ""
Tmp = Text1.Text
Open "C:\testing.txt" For Output As #1
Print #1, Tmp
Close #1
End Sub
The code I am working with looks like this.
Private Sub Command1_Click()
Dim Tmp As String
Tmp = Text1.Text
Open "C:\testing.txt" For Output As #1
Print #1, Tmp
Close #1
' I would like to eliminate this time pause for a wait for file ready pause.
Sleep (500)
Text1.Text = ""
Tmp = Text1.Text
Open "C:\testing.txt" For Output As #1
Print #1, Tmp
Close #1
End Sub
Thanks