Ab99
Member
I want to create an text file and want to write lines in it.
Creating the text file is not the problem.
But I can not write outside the Sub Form Load.
I have many subs were I want to writes lines into the same txt file.
How should I do this?
Creating the text file is not the problem.
But I can not write outside the Sub Form Load.
I have many subs were I want to writes lines into the same txt file.
Writing in an text file:
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Me.WindowState = FormWindowState.Maximized
Timer4.Enabled = False
comPORT1 = ""
For Each sp As String In My.Computer.Ports.SerialPortNames
Compoort1_ComboBox.Items.Add(sp)
Next
'###
Timer10.Enabled = False
comPORT2 = ""
For Each sp As String In My.Computer.Ports.SerialPortNames
Compoort2_ComboBox.Items.Add(sp)
Next
Dim Datumtijd As Date = Now()
fPath = "C:\TimingForHorses\Logging\log001.txt"
Dim afile As New IO.StreamWriter(fPath, True)
afile.WriteLine("hello1")
afile.Close()
End Sub
How should I do this?