RemovePort Method

Removes a virtual serial port with non-standard name.


Visual Basic .NET
Sub RemovePort(ByVal PortName As String) 
Visual C#
void RemovePort(String PortName);



[in] Virtual serial port name.


The method may throw exception. Use GetLastError method to get the error code.

ftvspcErrorFailed 1 The operation has not been completed.
ftvspcErrorNoSuchPort 101 There is no such port.
ftvspcErrorPortAttached 200 This port is already attached.
ftvspcErrorPortInUse 201 This port is opened by serial application.
ftvspcErrorMarkedForDeletion 202 This port is marked for deletion.


If COM port has been removed successfully, the function returns TRUE.

If COM port is occupied by a serial application, the function returns TRUE and sets last error code to ftvspcErrorPortInUse. COM port will be removed on COM port close. This COM port appears with MarkedForDeletion flag enabled when enumerate virtual serial ports.

If any application is attached to the COM port, the function returns FALSE and sets last error code to ftvspcErrorPortAttached.

See Also