-
Re: Can I send data via com ports?
In frmReceiver change the line just before the End Select right at the bottom of the OnComm event
Code:
'
' Processed this buffer so tell the sender
' we're ready for the next one
'
MSComm1.Output = "OK" & Chr(4)
to
'
' Processed this buffer so tell the sender
' we're ready for the next one
'
If boTransfer = True Then MSComm1.Output = "OK" & Chr(4)
-
Re: Can I send data via com ports?
It's only sending the first line, and then repeating 3 times..
For example is MyText.txt has this:
Code:
Hello
My name is Wxmancanada
The MyTextRX.txt has this:
And if I resend, all it does is replace how ever many lines there are.
This is still showing up on the radar too:
Code:
If Not EOF(intFile) Then
Edit: It's actually got a mind of its own right now, its doing anything at the moment. Add lines, remove lines.. Send 28 bytes, receive 7 of 46, lots of odd stuff.
-
Re: Can I send data via com ports?
You must delete MyTextRX.txt before you run the program. Also take out the DoEvents statements in both forms
-
Re: Can I send data via com ports?
Even with a fresh send, it still only copied the first line.
Also, I've tried to look at this and I can't find out why its causing the "Bad file name or number" error again:
Sender:
Code:
If Not EOF(intFile) Then
-
Re: Can I send data via com ports?
It seems like its only sending the first few bytes on information, I tried sending a larger file, still under 10 bytes sent.
Just tried large text file, it only sent the first line, which was 121 bytes. Only received 99.
-
1 Attachment(s)
Re: Can I send data via com ports?
New modified version attached
-
Re: Can I send data via com ports?
-
Re: Can I send data via com ports?
I re-modified the attachment in post 46 and put some debug statements in which will output to the immediate window. Could you try again with something like a 3 line file and post what you get in the immediate window please
-
Re: Can I send data via com ports?
After Sending:
MyText.txt:
Code:
Hello Everybody
My name is Wxmancanada
I am a Meterorologist from Canada
MyTextRX.txt:
Immediate Window:
Code:
Sent: Hello Everybody
Received: Hello Everybody
Sent: My name is Wxmancanada
Sent: I am a Meterorologist from Canada
-
Re: Can I send data via com ports?
I see what's going on. I am sending OK even when I have a partial buffer which is absolutely stupid. I've re-modified the code again in Post 46 so hopefully you may get more than one record - i'll sort the record counting out later - once we've actually got something worthwhile.
Sorry about all this, blame my age :)
-
Re: Can I send data via com ports?
Quote:
Originally Posted by Doogle
I see what's going on. I am sending OK even when I have a partial buffer which is absolutely stupid. I've re-modified the code again in Post 46 so hopefully you may get more than one record - i'll sort the record counting out later - once we've actually got something worthwhile.
Perfect! It works! I've tried it under many different text file arangments, worked everytime. No errors!
Quote:
Originally Posted by Doogle
Sorry about all this, blame my age :)
I appreciate all of your help, you've been very patient with helping me, thank you!
I won't make you stick around tonight, but I would like to learn how to control one VB application via COM.. Basically working through the same idea, but like if I were to have one computer with the sender, and on that sender I type something in to a Text box, have the sender send Text1.Text over the serial cable to the other computer where it receives it and puts it in a label or text box on that end. I'm sure its harder then it sounds.
-
Re: Can I send data via com ports?
As I think I've just demonstrated there's a huge difference between sorting out the logic and actully implementing it !
However, now that the FT works, the same implementation could be used with a slight modification. ie instead of reading the data from a file it can be 'read' from a TextBox and instead of writing to a file at the receiver it could be 'written' to a TextBox.
-
Re: Can I send data via com ports?
So I assume, intFile would have to be changed? I'm working on it now.
-
1 Attachment(s)
Re: Can I send data via com ports?
Attached is an example of a TextBox to TextBox transfer via the Serial Port .
Again, not tested but It's based on the File Transfer code so fingers crossed. :)
-
Re: Can I send data via com ports?
Thanks for posting again!
Right off the start of loading the project file:
http://i166.photobucket.com/albums/u...dingerrors.png
Line in the Sender:
Code:
StatusBar1.Panels(1).Text = "Receiver Confirms Receipt"
In the error log:
Code:
Line 13: Class MSComctlLib.StatusBar of control StatusBar1 was not a loaded control class.
Line 20: The property name _ExtentX in StatusBar1 is invalid.
Line 21: The property name _ExtentY in StatusBar1 is invalid.
Line 22: The property name _Version in StatusBar1 is invalid.
Line 29: The property name Panels in StatusBar1 is invalid.
-
Re: Can I send data via com ports?
Go intp Project -> Components and see if you've got "Windows Common Controls 6.0" if you have ,then check the check box
-
Re: Can I send data via com ports?
I had to replace the Status Bar with the one in the components list.
New error (frmSender) (Else without If):
Code:
strBuffer = ""
boFinished = True
End If
Else
boFinished = True
End If
Loop Until boFinished = True
-
Re: Can I send data via com ports?
New version without StatusBar and corrected logic now attached in Post #54.
-
Re: Can I send data via com ports?
This is the old send .txt file one :P Not the Text Box..
-
Re: Can I send data via com ports?
See what happens when you try to be clever at 3am ! The correct one is there now. (Post #54)
-
Re: Can I send data via com ports?
Receiver (Else without If):
Code:
MSComm1.Output = "OK" & Chr(4)
End If
Else
'
' Didn't find a complete record, exit
'
boFinished = True
End If
-
Re: Can I send data via com ports?
Well, I've just downloaded it and I don't get that error. Are you sure you've downloaded it again / opened the correct project ?
-
Re: Can I send data via com ports?
Downloaded it 4 times, get the same error every time.
Problem posted in post #61
-
Re: Can I send data via com ports?
Can you please PM me and attach the zip file you downloaded to it .... I'm totally confused
-
Re: Can I send data via com ports?
Quote:
Originally Posted by Doogle
Can you please PM me and attach the zip file you downloaded to it .... I'm totally confused
Sent it!
-
Re: Can I send data via com ports?
That is the old one. If you notice, it's larger than the one currently attached to Post #54 which is 3.3kb. According to the Forum, that attachment has only been looked at twice. Have you tried refreshing your browser / logging off and logging on to the Forums. I suspect that something is cached.
-
Re: Can I send data via com ports?
Cleared the cache, cleaned out the temp files, logged out, cleared the history, used different browser. I'm still getting the old TXT project, sorry.
I'll PM you my email, can we try it that way?
-
Re: Can I send data via com ports?
Okay, I actually got the file.. But it says the Path cannot be found, its going back 2 directorys instead of looking in the same folder. But even if I tell the project to look in the same folder, that "End without If" error comes up.
-
Re: Can I send data via com ports?
Ok. Let's try via e-mail I'll PM you my address
-
Re: Can I send data via com ports?
Some would say "Receiver Confirms Receipt" (I got it, and it works!)
Thanks!
-
Re: Can I send data via com ports?
Phew.... wipes forehead..... thought I was going bonkers :bigyello: Time for a Cup of Tea !
-
Re: Can I send data via com ports?
You deserve it! Thank you!
This should work using LPT as well, right?
-
Re: Can I send data via com ports?
Quote:
Originally Posted by wxmancanada
This should work using LPT as well, right?
erm...no... LPT is the Parallel Port and a completely different kettle of worms.
It is possible to use the Parallel Port for bi-directional serial and / or parallel communications but not using the MSComm control. There's a 3rd party DLL available (free download from the Internet - but can't remember what it's called)
-
Re: Can I send data via com ports?
LOL, oh boy.. Earlier today I bought a 20 foot Parallel Port for this, time to return! :-P
-
Re: Can I send data via com ports?
Just in case anyone is interested the DLL I refered to is called Inpout.dll and is available here: http://www.lvr.com/parport.htm
-
Re: Can I send data via com ports?
Perhaps this thread is now resolved(?) You can mark it such by selecting "Mark Thread Resolved" under "Thread Tools" at the top of the screen