serial on Mac & Windows

I have a problem to get a serial port read on windows while it works on Mac.
I initialize as follows:
W_serial.Serial1.SerialPort = system.serialport(rng_portnumber) ‘ i detected the port number by looking at the names
W_serial.Serial1.Baud=W_serial.Serial1.Baud9600 // or 2
W_serial.Serial1.Parity=W_serial.Serial1.ParityNone // or 0
W_serial.Serial1.Bits=3 //8 bits. //
W_serial.Serial1.Stop=W_serial.Serial1.StopBits15 //or 1

then when needed I switch on the port with:
dim status as Boolean
status =
W_serial.Serial1.DTR= true

and start polling the port:
while data_available_flag =false
with the dataavailable event reading the port:
serial1.DTR =False 'don’t ask further data
true_rbyte =

This works fine but not on windows. However the following works on windows (showing some superiority of matlab?)
rng = serial(‘COM7’);
random_byte = fread(rng, 1);

Note that the COM7 port is associated with the port number I use in the XOJO code.

Who has any idea what I am doing incorrectly?

Any time you change the line state (or other properties) while the port is open, you must call Reset.