Sample code for 30+ languages & platforms
VB.NET

Get Contents of File as Base64

See more Encryption Examples

Demonstrates how to read the contents of a file and convert to a base64 string.

Chilkat VB.NET Downloads

VB.NET
Dim success As Boolean = False

Dim bd As New Chilkat.BinData

success = bd.LoadFile("qa_data/jpg/starfish.jpg")
If (success = False) Then
    Debug.WriteLine("Failed to load file.")
    Exit Sub
End If


Debug.WriteLine(bd.GetEncoded("base64"))

' If you want mult-line base64:
Debug.WriteLine("--")
Debug.WriteLine(bd.GetEncoded("base64_mime"))

' If you want hex..
Debug.WriteLine("--")
Debug.WriteLine(bd.GetEncoded("hex"))

' etc.