User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the Visual Basic 4 / 5 / 6 section within the Software Development category of DaniWeb, a massive community of 456,492 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,685 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our Visual Basic 4 / 5 / 6 advertiser: Programming Forums
Views: 1050 | Replies: 1
Reply
Join Date: Sep 2007
Posts: 6
Reputation: BULK is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
BULK BULK is offline Offline
Newbie Poster

Help Save UDP data to file

  #1  
Sep 20th, 2007
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
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Sep 2007
Posts: 6
Reputation: BULK is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
BULK BULK is offline Offline
Newbie Poster

Help Re: Save UDP data to file

  #2  
Sep 21st, 2007
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
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb Visual Basic 4 / 5 / 6 Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Similar Threads
Other Threads in the Visual Basic 4 / 5 / 6 Forum

All times are GMT -4. The time now is 3:20 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC