 |
| View previous topic :: View next topic |
| Author |
Message |
sundaecone Newbie
Joined: 03 Jun 2005 Posts: 2
|
Posted: Jun 3rd, 2005 02:01 AM Post subject: auto-saving & sequential filename? |
|
|
i was wondering if this is possible in VB..
here's my situation:
i have a microcontroller connected at com1.. my PC sends info to the microcontroller then the microcontroller manipulates the sent info, afterwards the microcontroller sends the manipulated info to my PC, my VB project accepts this info and displays it..
what i want to do:
1.) i want the said manipulated info to be stored first into an array then saved *automatically* into a text file after a certain *end of file to be saved* signal is sent by the microcontroller. is this possible?
2.) also, would it be possible that the VB program would save the text file using sequential filenames? (ie. file01.txt, file02.txt, file03.txt etc)
why i want it?
because, our project requires a series of testing and we want to test the system with all possible scenarios before looking at the final data..
thanks in advance! =D _________________ Eternally Grateful,
SundaeCone |
|
| Back to top |
|
rbgCODE Regular
Joined: 11 Nov 2004 Posts: 54 Location: Manchester CT
|
Posted: Jun 3rd, 2005 10:54 AM Post subject: |
|
|
Here is the code for the sequential file names
| Code: |
Public Function makeFileName() As String
Dim curDate' this is the prefix so make it what you want.
Dim curStep
curDate = Format(Date, "YYYYMMDD")
curStep = "001"
While FileExist(App.Path & "\" & curDate & curStep & ".TXT") = True
curStep = Val(curStep) + 1
curStep = makeClen(CStr(curStep), 3)
Wend
If Len(curStep) = 2 Then curStep = "0" & curStep
makeFileName = curDate & curStep & ".TXT"
End Function
|
and here is the code to save it to the text file.
| Code: |
Public Function addTXT(theStr As String, TheFile As String)
Dim ff
ff = FreeFile
TheFile = App.Path & "\" & TheFile
Open TheFile For Append As #ff
Write #ff, theStr
Close #ff
End Function
|
_________________ '><>
'rBg
'><> |
|
| Back to top |
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|