QR image generator

StewartBW 1,145 Reputation points
2024-06-25T22:53:36.7033333+00:00

Hello experts,

I need to generate the QR code image from a simple text (contact) file and found many commercial components but am not allowed to use any third party dlls, few free source codes including vCardEditor on github, but all are C# which I cannot understand or successfully convert to VB.

Anyone knows a VB.net tutorial or source code on MSDN?

And this task only needs the contents of contact file (string) as input? Am I right?

Thanks in advance.

VB
VB
An object-oriented programming language developed by Microsoft that is implemented on the .NET Framework. Previously known as Visual Basic .NET.
2,733 questions
0 comments No comments
{count} votes

Accepted answer
  1. Jiachen Li-MSFT 32,056 Reputation points Microsoft Vendor
    2024-06-26T02:10:25.05+00:00

    Hi @StewartBW ,

    Since you cannot use third-party DLLs, you can use an open-source QR code generation library written in pure .NET. For example QRCoder library which you can install in NuGet Package Manager.

        Sub GenerateQRCode(contactInfo As String)
            Dim qrGenerator As New QRCodeGenerator()
            Dim qrCodeData As QRCodeData = qrGenerator.CreateQrCode(contactInfo, QRCodeGenerator.ECCLevel.Q)
            Dim qrCode As New QRCode(qrCodeData)
            Dim qrCodeImage As Bitmap = qrCode.GetGraphic(20)
    
            ' Save the QR code as an image file
            qrCodeImage.Save("path_to_save_qrcode_image.png", Imaging.ImageFormat.Png)
        End Sub
    

    Best Regards.

    Jiachen Li


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment". Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    1 person found this answer helpful.
    0 comments No comments

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.