本文整理汇总了VB.NET中System.IO.Ports.StopBits枚举的典型用法代码示例。如果您正苦于以下问题:VB.NET StopBits枚举的具体用法?VB.NET StopBits怎么用?VB.NET StopBits使用的例子?那么恭喜您, 这里精选的枚举代码示例或许可以为您提供帮助。
在下文中一共展示了StopBits枚举的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的VB.NET代码示例。
示例1: SerialPort
Dim mySerialPort As New SerialPort("COM1")
mySerialPort.BaudRate = 9600
mySerialPort.Parity = Parity.None
mySerialPort.StopBits = StopBits.One
mySerialPort.DataBits = 8
mySerialPort.Handshake = Handshake.None
mySerialPort.RtsEnable = True
示例2: SetPortStopBits
' Display StopBits values and prompt user to enter a value.
Public Shared Function SetPortStopBits(defaultPortStopBits As StopBits) As StopBits
Dim stopBits As String
Console.WriteLine("Available StopBits options:")
For Each s As String In [Enum].GetNames(GetType(StopBits))
Console.WriteLine(" {0}", s)
Next
Console.Write("Enter StopBits value (None is not supported and " &
vbLf & "raises an ArgumentOutOfRangeException. " &
vbLf & " (Default: {0}):", defaultPortStopBits.ToString())
stopBits = Console.ReadLine()
If stopBits = "" Then
stopBits = defaultPortStopBits.ToString()
End If
Return CType([Enum].Parse(GetType(StopBits), stopBits, True), StopBits)
End Function