Expand|Select|Wrap|Line Numbers
- Private Sub Form_Unload(Cancel As Integer)
- MSComm1.PortOpen = False ' Close the comm port
- End Sub
- Private Sub Timer1_Timer()
- If MSComm1.PortOpen = False Then ' If comm port is not open
- MSComm1.PortOpen = True ' Open it
- End If
- If MSComm1.InBufferCount > 0 Then ' If theres data in comm buffer
- inst = inst + MSComm1.Input ' Get the data
- Text1.Text = inst ' Show its value
- Filename.Text = Text1.Text
- Text2.Text = Text1.Text
- End If
- If Text1.DataChanged < True Then
- Open "C:\test\" + Filename.Text + ".txt" For Output As #1 'location of the file.
- Write #1, Text1.Text, Text2.Text 'The things you want to save
- Close 1
- End If
- End Sub