CByte 函数

目录

# CByte Function

Converts a string or a numeric expression to the Byte type.

### 语法:

    Cbyte( expression As Variant) As Byte

### Return type:

Byte

### 参数:

Expression: Any string or a numeric expression that can be evaluated to a number. Decimal values are rounded to the nearest tenth. Valid values range from 0 to 256.

### 错误代码:

5 无效的过程调用

6 溢出

### 示例:

      Sub CByte_example
          Print CByte( expression := "17"/2 + 7.44), CByte(EMPTY), CByte(PI)
          ' Above expressions are computed as 16, 0 and 3
      End Sub

相关主题

CBool Function

CCur Function

CDate Function

CDbl Function

CDec Function

CInt Function

CLng Function

CSng Function

CStr Function