property ComNumber : Word
Default: 0
Determines the serial port number used by the TApxComPort component.
ComNumber does not validate the port number. When the port is opened, the communications driver will determine whether the port number is valid and generate an error if it is not.
If the port is open when ComNumber is changed, the existing port is closed and then reopened using the new number. Triggers are maintained during this operation.
The ComNumber property is tied internally to the DeviceName property. When ComNumber is set to a new value, DeviceName is automatically set to a platform appropriate value based on the selected ComNumber.
The following example creates, configures, and opens a comport component at run time:
ApxComPort := TApxComPort.Create(Self);
ApxComPort.ComNumber := 1; {use Com1}
ApxComPort.Baud := 9600;
ApxComPort.Parity := pNone;
ApxComPort.DataBits := dbEight;
ApxComPort.StopBits := 1;
ApxComPort.Open := True;
See also: DeviceName