• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 2364
  • Last Modified:

.Net System.Convert.ToBase64String equivalent in VB6


I'm not quite sure what is equivalent to .Net System.Convert.ToBase64String function in VB6. See function below.

How to convert the below to VB6 version? thks

// Convert the read file input into Base64 encoded output

public static string FileToBase64(string fileName)
      byte[] binaryData;
      System.IO.FileStream inputFileName = new System.IO.FileStream(fileName,
                        System.IO.FileMode.Open, System.IO.FileAccess.Read);
      binaryData = new Byte[inputFileName.Length];
      return System.Convert.ToBase64String(binaryData, 0, binaryData.Length);
Ryan Chong
Ryan Chong
4 Solutions
As far as I am aware, this is not supported directly in VB
Many Datatypes supportedin .NET are not supported in VB6. But, then you can write custom functions or procedures to get the same. I need to work on it before giving u solution. If anyone elase gives it, thats great.
It's like converting to Hex which is base 16, but to base 64.
In the same way that Hex has to use letters to represent digits, so does Base 64.

But, as I understand it, the sequence doesn't start with 0 to 9 and then extend with letters, but just starts with A=0, B=1 up to Z = 25. Then come the lower case letters, then the 10 digiits and finally + and /.

I'm sure that with that information a person of your calibre can code an equivalent in VB6
Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

There is base64 activex dll here: http://www.sevillaonline.com/ActiveX/Base64.htm
It is free and works fine
Ryan ChongAuthor Commented:
Thks guys for the info, i will explore the links provided and let you guys know soon ;-) cheers
Ryan ChongAuthor Commented:
Thks guys for the links, they tested working
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now