
Originally Posted by
nickz Looking for a jumpstart to create a "simple"
VB program to send and receive G- code files, (from a PC to a
CNC machine). Any help would be appreciated.
Thanks
I made one a while back in VB6. It's called SComm. I won't give you the code, but if you have specific questions I'll be glad to help.
The VBterm is a good place to start but does not cover some of the things you'll need for this type of RS232 communications.
In it's very simplest form, you could use something like what I've done inside a Microsoft Access database...
Code:
Private Sub cmdSend_Click()
Dim strNCLink As String
Me.txtCustomer.SetFocus
strNCLink = "C:\Foldername\" & Me.txtCustomer.Text & "\" & Me.NCName
On Error GoTo Hell
Open strNCLink For Input As #1
MSComm1.InputLen = 0
MSComm1.PortOpen = True
Do While Not EOF(1)
Line Input #1, Rec
CharSent = CharSent + Len(Rec)
MSComm1.Output = Rec & vbCrLf
lblBytes.Caption = CharSent & " bytes"
DoEvents
Loop
Hell:
On Error Resume Next
Close
MSComm1.PortOpen = False
MsgBox "Oh, crap. Something bad just happened...", vbCritical, "Error Hit While Transferring"
End Sub