|
-
Sep 25th, 2000, 06:57 AM
#1
Thread Starter
New Member
hello all!!!
need some help!!
creating a program that sends and receive data through com ports
got a loop that searches for an eof character!! this is after it has recieve all the data!! however there does not seem to be one that is sent with the file that i have sent! i hope that makes sence to someone???
can anyone help??
here is my code that receive incoming data:
Private Sub mnuReceiveText_Click()
Dim replace
On Error Resume Next
OpenLog.Flags = cdlOFNHideReadOnly Or cdlOFNExplorer
OpenLog.CancelError = True
' Get the log filename from the user.
OpenLog.DialogTitle = "Open Text File"
OpenLog.Filter = "Text Files (*.TXT)|*.txt|All Files (*.*)|*.*"
Do
OpenLog.FileName = ""
OpenLog.ShowOpen
If Err = cdlCancel Then Exit Sub
Receive = OpenLog.FileName
' If the file already exists, ask if the user wants to overwrite the file or add to it.
Ret = Len(Dir$(Receive))
If Err Then
MsgBox Error$, 48
Exit Sub
End If
If Ret Then
replace = MsgBox("Replace existing file - " + Receive + "?", 35)
Else
replace = 0
End If
Loop While replace = 2
' User clicked the Yes button, so delete the file.
If replace = 6 Then
Kill Receive
If Err Then
MsgBox Error$, 48
Exit Sub
End If
End If
' Open the text file.
hReceiveFile = FreeFile
Open Receive For Binary Access Write As hReceiveFile
txtTelNum.Text = MSComm1.InBufferCount
Do Until EOF(hReceiveFile) ' REMOVE THIS !!!!!
If Err Then
MsgBox Error$, 48
Close hReceiveFile
hReceiveFile = 0
Exit Sub
Else
' Go to the end of the file so that new data can be appended.
DoEvents
Seek hReceiveFile, LOF(hReceiveFile) + 1
End If
'Do Until EOF(hReceiveFile) '= True to look for the eof char in hreceivefile
'DoEvents
'MSComm1.EOFEnable = True
Loop 'Until MSComm1.InBufferCount = 0
Close hReceiveFile ' to close the hrecieve file
hReceiveFile = 0
txtTerm.Text = ""
'frmTerminal.Caption = "Visual Basic Terminal - " + OpenLog.FileTitle
'mnuOpenLog.Enabled = False
'tbrToolBar.Buttons("OpenLogFile").Enabled = False
'mnuCloseLog.Enabled = True
'tbrToolBar.Buttons("CloseLogFile").Enabled = True
End Sub
i have used the vbterm example that comes with vb as a template for this program!!
if anyone can help i will be grateful as i am pulling my hair out with these problems and i will soon be bold!
-
Sep 25th, 2000, 08:27 AM
#2
Lively Member
Hmm a puzzling one, Have you checked that you are actually sending the EOF char?
When sending the file are you adding the EOF? or using a UNTIL eof(freef) loop?
THE DOUGSTER!!!!!!
*-MCSD-*
-
Sep 25th, 2000, 08:37 AM
#3
Thread Starter
New Member
hello!!
yep checked the character it is 26 (well i think!!)
yes when sending the data i am using a until eof(freefile)
so how can i send this character???? i am very conmfused ???
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|