Convert |
Name | Description |
---|---|
FromBase64CharArray | Decodes a base-64 character array to a byte array. The Offset and length specify a subset of the character array to be decoded. |
FromBase64String | A base-64 string containing characters to be decoded to a byte array. |
ToBase64CharArray | Converts the value of a subset of a byte array to an equivalent subset of a Unicode character array consisting of base 64 digits. Parameters specify the subsets as offsets of the input and output arrays and the number of elements in the input array. |
ToBase64String | Converts the value of a subset of a byte array to an equivalent subset of a Unicode character string consisting of base-64 characters. Parameters specify the subsets as offsets of the input array and the number of elements in the input array to process. |
ToDateTime | Converts the value of the specified object to a CorDateTime object, using the specified culture-specific formatting information. |
ToInt64 | Converts the value of the specified object to a 64-bit signed integer. |
ToString | Converts a datatype value to a string representation using any supplied formatting or provider arguments. |
To access the methods of this class, call the method using the Convert.Method syntax.
This example takes a byte array containing 10 elements with values 1 to 10 and encodes it into a Base-64 string encoding. The encoded string is then decoded back into the original byte array and displayed for view.
Private Sub Main() Dim Original() As Byte Dim Decoded() As Byte Dim s As String ' Create a byte array containing values 1 to 10. Original = NewBytes(1, 2, 3, 4, 5, 6, 7, 8, 9, 10) ' Display the original byte array values Debug.Print "Original Bytes" DisplayBytes Original ' Encode the byte array into a Base-64 Encoded string. s = Convert.ToBase64String(Original) ' Display Base-64 Encoded string. Debug.Print t("\nBase-64 Encoded String") Debug.Print " " & s ' Decode Base-64 string into byte array. Decoded = Convert.FromBase64String(s) ' Display decoded byte array. Debug.Print t("\nBytes After Decoding") DisplayBytes Decoded End Sub 'Displays the contents of a byte array. Private Sub DisplayBytes(ByRef Bytes() As Byte) Dim i As Long Debug.Print " "; For i = LBound(Bytes) To UBound(Bytes) Debug.Print Bytes(i) & " "; Next i Debug.Print End Sub ' This code produces the following output. ' ' Original Bytes ' 1 2 3 4 5 6 7 8 9 10 ' ' Base-64 Encoded String ' AQIDBAUGBwgJCg== ' ' Bytes After Decoding ' 1 2 3 4 5 6 7 8 9 10