0

Hi, all
I have an application that listen to a port, and receives UDP data. The data is sent to a textbox.
I want to add a checkbox, and when the checkbox is =1 then I want the UDP data to be saved to a file on desktop with date and time.
Thank's

1
Contributor
1
Reply
2
Views
9 Years
Discussion Span
Last Post by BULK
0

I made this code, and it does the job. But it doesn't make a new file when I check and uncheck the checkbox. I can only make one log, then I need to restart my program, to make a new log.

Private Sub sckUDP_DataArrival(ByVal bytesTotal As Long)

On Error Resume Next
If Err Then MsgBox Error$, 48
Dim filelocation As String
Dim strData As String

sckUDP.GetData strData 'Retrieve the data
txtReceive.Text = strData 'Display it

If chkLog = 1 Then
filelocation = "UDP_Log" & "-" & Format(Now, "yyyymmdd hhmmss") & ".txt"
Open filelocation For Append As #1
Print #1, txtReceive.Text
If chkLog = 0 Then
Close #1

End If
End If

End Sub

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.