VB.Net to VB6 Conversion

Posted on 2013-01-05
Last Modified: 2013-01-05
Hi Experts,

Can anybody convert the following code to VB6?

Private Function SHA512String(ByVal input As String) As String
        Dim data() As Byte = System.Text.Encoding.ASCII.GetBytes(input)
        Dim shaM As New SHA512Managed()
        Dim result() As Byte = shaM.ComputeHash(data)
        Dim output As String = ""
        For Each b As Byte In result
            output += b.ToString("x2")
        Return output
    End Function
Question by:Soumen-Roy
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
LVL 75

Expert Comment

by:käµfm³d 👽
ID: 38747339
I'm not sure VB6 has a readily available SHA 512 library. You may need to implement your own.
LVL 70

Expert Comment

by:Éric Moreau
ID: 38747347
I think it would be easier to create a component (.dll) in .Net with this code and use it from VB6.

Author Comment

ID: 38747354

Is it not possible to do that in VB6?

I can make VB.Net dll from that code, say named a.dll. But I don't know how the dll can be called from VB6. Can you please help?

MS Dynamics Made Instantly Simpler

Make Your Microsoft Dynamics Investment Count  & Drastically Decrease Training Time by Providing Intuitive Step-By-Step WalkThru Tutorials.

LVL 70

Expert Comment

by:Éric Moreau
ID: 38747376

Author Comment

ID: 38747386

Thank you for the link, just one more little query, if I make the above function in VB.Net and compile it as dll, then call that dll from VB6 exe, will that VB6 exe need framework as it is calling .net dll or; framework will not needed as it is compiled as COM?

Please help,
LVL 70

Accepted Solution

Éric Moreau earned 500 total points
ID: 38747392
you will need the .Net framework. the good thing is that it is installed on almost all PC now!

Author Closing Comment

ID: 38747393
Thanx for the idea, I will try it, Thanx a lot

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity VSTO Excel Ribbon error 4 27
ASP.NET Complete Life Cycle for all the controls 2 42
SQL Server Serialization error 8 43
PowerShell:  foreach where object notmatch? 17 75
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

737 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question