There is quite a large number of settings for the Comm Control, none of which are really explained in the Visual Basic help.
Settings
The first property that you can set is the Settings property(!). The Settings property allows you to specify the baud rate, parity, and the number of data bits and stop bits. By default, the baud rate (which is the maximum speed of the COM port) is set at 9600. The parity setting is for data validation. It is commonly not used, and set to "N". The data bits setting specifies the number of bits that represent a chunk of data. The stop bit indicates when a chunk of data has been received.
The settings string takes the following format.
"BBBB,P,D,S"
Where BBBB is the baud rate, P is the parity, D is the number of data bits, and S is the number of stop bits. The default value of value is:
"9600,N,8,1"
If the settings property is invalid when you attempt to open the port, an error 380 (Invalid property value) occurs.
Click here for the valid settings for each of these.
Buffer Memory Allocation
The InBufferSize and OutBufferSize properties specify how much memory is allocated to the receive and transmit buffers (which store the in-coming and out-going data). The larger you make the number, the less memory you have available to your application. If, however, your buffer is too small, you run the risk of overflowing the buffer unless you use handshaking.However, given the amount of memory available to most PCs at this time, buffer memory allocation is less crucial because you have more resources available. In other words, you can set the buffer values higher without affecting the performance of your application.
The RThreshold and SThreshold Properties
The RThreshold and SThreshold properties set or return the number of characters that are received into the receive and transmit buffers before the OnComm event is fired. The OnComm event is used to monitor and respond to changes in communications states. Setting the value for each property to 0 (which is the default value) prevents the OnComm event from firing. Setting the value to something other than 0 (1, for instance) causes the OnComm event to be fired every time a single character is received into either buffer.
The InputLen and EOFEnable Properties
Setting the InputLen property to 0 causes the Communications control to read the entire contents of the receive buffer when the Input property is used. When reading data from a machine whose output is formatted in fixed-length blocks of data, the value of this property can be set appropriately.
The EOFEnable property is used to indicate when an End of File (EOF) character is found during data input. Setting this to True causes data input to stop and the OnComm event to fire to inform you that this condition has occurred.
The InputMode Property
The InputMode property determines how data will be retrieved through the Input property. This data will either be a string (plain text), or as a byte array (binary data). Use comInputModeText for data that uses the ANSI character set (plain text). Use comInputModeBinary for all other data such as data that has embedded control characters, Nulls, etc.
Comments