# Conversion.Oct Method

## Definition

Important

Some information relates to prerelease product that may be substantially modified before itâ€™s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.

Returns a string representing the octal value of a number.

## Overloads

Oct(UInt64) |
Returns a string representing the octal value of a number. |

Oct(UInt32) |
Returns a string representing the octal value of a number. |

Oct(UInt16) |
Returns a string representing the octal value of a number. |

Oct(SByte) |
Returns a string representing the octal value of a number. |

Oct(Byte) |
Returns a string representing the octal value of a number. |

Oct(Int64) |
Returns a string representing the octal value of a number. |

Oct(Int32) |
Returns a string representing the octal value of a number. |

Oct(Int16) |
Returns a string representing the octal value of a number. |

Oct(Object) |
Returns a string representing the octal value of a number. |

## Oct(UInt64)

- Source:
- Conversion.vb

- Source:
- Conversion.vb

- Source:
- Conversion.vb

Important

This API is not CLS-compliant.

- CLS-compliant alternative
- Microsoft.VisualBasic.Conversion.Oct(Int64)

Returns a string representing the octal value of a number.

```
public:
static System::String ^ Oct(System::UInt64 Number);
```

```
[System.CLSCompliant(false)]
public static string Oct (ulong Number);
```

```
[<System.CLSCompliant(false)>]
static member Oct : uint64 -> string
```

`Public Function Oct (Number As ULong) As String`

#### Parameters

- Number
- UInt64

Required. Any valid numeric expression or `String`

expression.

#### Returns

A string representing the octal value of a number.

- Attributes

#### Exceptions

`Number`

is not specified.

`Number`

is not a numeric type.

### Examples

This example uses the `Oct`

function to return the octal value of a number.

```
Dim testOct As String
' Returns "4".
testOct = Oct(4)
' Returns "10".
testOct = Oct(8)
' Returns "713".
testOct = Oct(459)
```

### Remarks

If `Number`

is not already a whole number, it is rounded to the nearest whole number before being evaluated.

If Number is | Oct returns |
---|---|

Empty | Zero (0) |

Any other number | Up to 22 octal characters |

You can represent octal numbers directly by preceding numbers in the proper range with `&O`

. For example, `&O10`

is the octal notation for decimal 8.

### See also

### Applies to

## Oct(UInt32)

- Source:
- Conversion.vb

- Source:
- Conversion.vb

- Source:
- Conversion.vb

Important

This API is not CLS-compliant.

- CLS-compliant alternative
- Microsoft.VisualBasic.Conversion.Oct(Int32)

Returns a string representing the octal value of a number.

```
public:
static System::String ^ Oct(System::UInt32 Number);
```

```
[System.CLSCompliant(false)]
public static string Oct (uint Number);
```

```
[<System.CLSCompliant(false)>]
static member Oct : uint32 -> string
```

`Public Function Oct (Number As UInteger) As String`

#### Parameters

- Number
- UInt32

Required. Any valid numeric expression or `String`

expression.

#### Returns

A string representing the octal value of a number.

- Attributes

#### Exceptions

`Number`

is not specified.

`Number`

is not a numeric type.

### Examples

This example uses the `Oct`

function to return the octal value of a number.

```
Dim testOct As String
' Returns "4".
testOct = Oct(4)
' Returns "10".
testOct = Oct(8)
' Returns "713".
testOct = Oct(459)
```

### Remarks

If `Number`

is not already a whole number, it is rounded to the nearest whole number before being evaluated.

If Number is | Oct returns |
---|---|

Empty | Zero (0) |

Any other number | Up to 22 octal characters |

You can represent octal numbers directly by preceding numbers in the proper range with `&O`

. For example, `&O10`

is the octal notation for decimal 8.

### See also

### Applies to

## Oct(UInt16)

- Source:
- Conversion.vb

- Source:
- Conversion.vb

- Source:
- Conversion.vb

Important

This API is not CLS-compliant.

- CLS-compliant alternative
- Microsoft.VisualBasic.Conversion.Oct(Int16)

Returns a string representing the octal value of a number.

```
public:
static System::String ^ Oct(System::UInt16 Number);
```

```
[System.CLSCompliant(false)]
public static string Oct (ushort Number);
```

```
[<System.CLSCompliant(false)>]
static member Oct : uint16 -> string
```

`Public Function Oct (Number As UShort) As String`

#### Parameters

- Number
- UInt16

Required. Any valid numeric expression or `String`

expression.

#### Returns

A string representing the octal value of a number.

- Attributes

#### Exceptions

`Number`

is not specified.

`Number`

is not a numeric type.

### Examples

This example uses the `Oct`

function to return the octal value of a number.

```
Dim testOct As String
' Returns "4".
testOct = Oct(4)
' Returns "10".
testOct = Oct(8)
' Returns "713".
testOct = Oct(459)
```

### Remarks

If `Number`

is not already a whole number, it is rounded to the nearest whole number before being evaluated.

If Number is | Oct returns |
---|---|

Empty | Zero (0) |

Any other number | Up to 22 octal characters |

You can represent octal numbers directly by preceding numbers in the proper range with `&O`

. For example, `&O10`

is the octal notation for decimal 8.

### See also

### Applies to

## Oct(SByte)

- Source:
- Conversion.vb

- Source:
- Conversion.vb

- Source:
- Conversion.vb

Important

This API is not CLS-compliant.

- CLS-compliant alternative
- Microsoft.VisualBasic.Conversion.Oct(Byte)

Returns a string representing the octal value of a number.

```
public:
static System::String ^ Oct(System::SByte Number);
```

```
[System.CLSCompliant(false)]
public static string Oct (sbyte Number);
```

```
[<System.CLSCompliant(false)>]
static member Oct : sbyte -> string
```

`Public Function Oct (Number As SByte) As String`

#### Parameters

- Number
- SByte

Required. Any valid numeric expression or `String`

expression.

#### Returns

A string representing the octal value of a number.

- Attributes

#### Exceptions

`Number`

is not specified.

`Number`

is not a numeric type.

### Examples

This example uses the `Oct`

function to return the octal value of a number.

```
Dim testOct As String
' Returns "4".
testOct = Oct(4)
' Returns "10".
testOct = Oct(8)
' Returns "713".
testOct = Oct(459)
```

### Remarks

`Number`

is not already a whole number, it is rounded to the nearest whole number before being evaluated.

If Number is | Oct returns |
---|---|

Empty | Zero (0) |

Any other number | Up to 22 octal characters |

`&O`

. For example, `&O10`

is the octal notation for decimal 8.

### See also

### Applies to

## Oct(Byte)

- Source:
- Conversion.vb

- Source:
- Conversion.vb

- Source:
- Conversion.vb

Returns a string representing the octal value of a number.

```
public:
static System::String ^ Oct(System::Byte Number);
```

`public static string Oct (byte Number);`

`static member Oct : byte -> string`

`Public Function Oct (Number As Byte) As String`

#### Parameters

- Number
- Byte

Required. Any valid numeric expression or `String`

expression.

#### Returns

A string representing the octal value of a number.

#### Exceptions

`Number`

is not specified.

`Number`

is not a numeric type.

### Examples

This example uses the `Oct`

function to return the octal value of a number.

```
Dim testOct As String
' Returns "4".
testOct = Oct(4)
' Returns "10".
testOct = Oct(8)
' Returns "713".
testOct = Oct(459)
```

### Remarks

`Number`

is not already a whole number, it is rounded to the nearest whole number before being evaluated.

If Number is | Oct returns |
---|---|

Empty | Zero (0) |

Any other number | Up to 22 octal characters |

`&O`

. For example, `&O10`

is the octal notation for decimal 8.

### See also

### Applies to

## Oct(Int64)

- Source:
- Conversion.vb

- Source:
- Conversion.vb

- Source:
- Conversion.vb

Returns a string representing the octal value of a number.

```
public:
static System::String ^ Oct(long Number);
```

`public static string Oct (long Number);`

`static member Oct : int64 -> string`

`Public Function Oct (Number As Long) As String`

#### Parameters

- Number
- Int64

Required. Any valid numeric expression or `String`

expression.

#### Returns

A string representing the octal value of a number.

#### Exceptions

`Number`

is not specified.

`Number`

is not a numeric type.

### Examples

This example uses the `Oct`

function to return the octal value of a number.

```
Dim testOct As String
' Returns "4".
testOct = Oct(4)
' Returns "10".
testOct = Oct(8)
' Returns "713".
testOct = Oct(459)
```

### Remarks

`Number`

is not already a whole number, it is rounded to the nearest whole number before being evaluated.

If Number is | Oct returns |
---|---|

Empty | Zero (0) |

Any other number | Up to 22 octal characters |

`&O`

. For example, `&O10`

is the octal notation for decimal 8.

### See also

### Applies to

## Oct(Int32)

- Source:
- Conversion.vb

- Source:
- Conversion.vb

- Source:
- Conversion.vb

Returns a string representing the octal value of a number.

```
public:
static System::String ^ Oct(int Number);
```

`public static string Oct (int Number);`

`static member Oct : int -> string`

`Public Function Oct (Number As Integer) As String`

#### Parameters

- Number
- Int32

Required. Any valid numeric expression or `String`

expression.

#### Returns

A string representing the octal value of a number.

#### Exceptions

`Number`

is not specified.

`Number`

is not a numeric type.

### Examples

This example uses the `Oct`

function to return the octal value of a number.

```
Dim testOct As String
' Returns "4".
testOct = Oct(4)
' Returns "10".
testOct = Oct(8)
' Returns "713".
testOct = Oct(459)
```

### Remarks

`Number`

is not already a whole number, it is rounded to the nearest whole number before being evaluated.

If Number is | Oct returns |
---|---|

Empty | Zero (0) |

Any other number | Up to 22 octal characters |

`&O`

. For example, `&O10`

is the octal notation for decimal 8.

### See also

### Applies to

## Oct(Int16)

- Source:
- Conversion.vb

- Source:
- Conversion.vb

- Source:
- Conversion.vb

Returns a string representing the octal value of a number.

```
public:
static System::String ^ Oct(short Number);
```

`public static string Oct (short Number);`

`static member Oct : int16 -> string`

`Public Function Oct (Number As Short) As String`

#### Parameters

- Number
- Int16

Required. Any valid numeric expression or `String`

expression.

#### Returns

A string representing the octal value of a number.

#### Exceptions

`Number`

is not specified.

`Number`

is not a numeric type.

### Examples

This example uses the `Oct`

function to return the octal value of a number.

```
Dim testOct As String
' Returns "4".
testOct = Oct(4)
' Returns "10".
testOct = Oct(8)
' Returns "713".
testOct = Oct(459)
```

### Remarks

`Number`

is not already a whole number, it is rounded to the nearest whole number before being evaluated.

If Number is | Oct returns |
---|---|

Empty | Zero (0) |

Any other number | Up to 22 octal characters |

`&O`

. For example, `&O10`

is the octal notation for decimal 8.

### See also

### Applies to

## Oct(Object)

- Source:
- Conversion.vb

- Source:
- Conversion.vb

- Source:
- Conversion.vb

Returns a string representing the octal value of a number.

```
public:
static System::String ^ Oct(System::Object ^ Number);
```

`public static string Oct (object Number);`

`static member Oct : obj -> string`

`Public Function Oct (Number As Object) As String`

#### Parameters

- Number
- Object

Required. Any valid numeric expression or `String`

expression.

#### Returns

A string representing the octal value of a number.

#### Exceptions

`Number`

is not specified.

`Number`

is not a numeric type.

### Examples

This example uses the `Oct`

function to return the octal value of a number.

```
Dim testOct As String
' Returns "4".
testOct = Oct(4)
' Returns "10".
testOct = Oct(8)
' Returns "713".
testOct = Oct(459)
```

### Remarks

`Number`

is not already a whole number, it is rounded to the nearest whole number before being evaluated.

If Number is | Oct returns |
---|---|

Empty | Zero (0) |

Any other number | Up to 22 octal characters |

`&O`

. For example, `&O10`

is the octal notation for decimal 8.