Recently I have used VB serial programming, getting the experience of two, bringing and sharing,
If the right thing, praise it, if you are not right, please advise prawn.
Experience 1: The output attribute of the serial port:
Follow the book or MSDN to give the data type of Output is a string or a variant type. I have the problem that I want to transmit 0 to 255, but according to the above output data type, transfer I can't like the number of 200, 210, etc., I don't want to convert according to the article introduced on the post, so I have a little experience: I will set the data type of the output of Output to the array of Byte, the number of array elements is 1 I.e.
DIM sentTemp (0) as byte
Const sendcmd = & h55
SendTemp (0) = sendcmd mscomm1.output = sendTemp ()
Experience 2: Setting up a problem with changing
When your serial port is set, once all the settings after you change a certain setting of the serial port, all settings need to be reset, such as setting the port number of the serial port, without setting the input mode of the serial port, if you think the front Enter mode has been set, without going to him, then he will use the default mode to handle your input. I causing unnecessary trouble, I am debugging for a while, I found this problem, I hope everyone will pay attention.