When I select the value "None" for the StopBits property on an instance of this control, I get a message <Property Value is not valid> with the following detail:
"Enum value was out of legal range.
Parameter name: StopBits"
This happens when I choose the value from the drop-down list, so it has to be a bug. Does anyone know how I can specify no stop bits

vb express SerialPort control error
JC Carmo
Me
.SerialPort1.StopBits = IO.Ports.StopBits.NoneSanomo
It is not that crazy to allow no stopbit. SerialPort is general useable, and if you e.g. wants to use it with a communication that uses NRZI (Not Return to Zero Invert), no stop bit is required. As far as I remember, low speed USB uses NRZI.
A standard UART uses NRZ coding where it is necessary with both a start bit and a stop bit, but if the communication is coded with NRZI, where the line state is inverted each time a "0" is transmitted, no stop bit is required. So when SerialPort uses the underlying SerialStream object it must tell how many stop bits are required and it is a little foolish to specify 1 if none is required - even though the driver can of course just ignore this field in case of NRZI coding.
Fraas
This, I believe, is a bug. There's no such thing as no stop bits (there was a discussion about this, not too long ago). You can only specify one, one and a half or two stop bits: these are the only valid values.
Marie C
kasl33
I didn't knew that the set function does not allow no stopbits. You are right that such inconsistency is not very clever. I just thought that maybe Microsoft had done some thinking when they allowed no stopbits, but it is obviously not the case!
Muhammad Abrar
lym51
jayk
The bug is in .NET because I get the same error using C#.
I fill a combobox using serialPort.GetNames and it returns 4 values None, One, OnePointFive and Two.
Also when in debugging mode and you check the values available for StopBits it also shows 4 values.
Will MicroSoft be issuing an update/patch for this error in .NET 2.0
boorad
But the point I wished to make is that for someone new to .NET and in particular serial port communications on .NET it can lead to some frustration and head scratching to work out what is wrong when Microsoft supplies sample code that contains the following Enum.GetNames(typeof(StopBits)) and this returns 4 values including None.
I searched Support Knowledge Base without finding any help. It was only when I came across this thread that the penny dropped.