IRONQRの使用 VB.NETでQRコードを生成する方法 Jordi Bardia 更新日:6月 22, 2025 Download IronQR NuGet Download Start Free Trial Copy for LLMs Copy for LLMs Copy page as Markdown for LLMs Open in ChatGPT Ask ChatGPT about this page Open in Gemini Ask Gemini about this page Open in Grok Ask Grok about this page Open in Perplexity Ask Perplexity about this page Share Share on Facebook Share on X (Twitter) Share on LinkedIn Copy URL Email article QR Code, or Quick Response Code, have evolved into versatile formats for storing and retrieving information. Widely used in diverse fields, from marketing to product labeling, QR Code images offer a quick and efficient means of accessing information through a simple scan of the picture box. In this article, we'll explore how to generate VB.NET QR Code barcodes within a Console Application, employing the IronQR library. IronQR IronQR, a robust C# Quick Response Code system library, extends its support to VB.NET developers for QR Code barcode generation and reading QR Code. Despite being primarily designed for C#, IronQR seamlessly integrates with VB.NET, as it is built upon .NET Framework, providing an accessible way to incorporate its functionality to easily create QR Code barcodes using VB.NET. Its simplicity and extensive feature set make it an ideal choice for developers seeking efficient VB.NET QR Code barcode generator solutions. Prerequisites Before delving into the coding process to create QR Code in VB.NET, ensure you have the required tools in place: Visual Studio: Make sure Visual Studio is installed on your system. If not, download it from the official website. IronQR Library: Install the IronQR library using the NuGet Package Manager in VS. Execute the following command in the Package Manager Console: Install-Package IronQR This command installs the necessary packages for working with IronQR in your VB.NET project. Creating a Console Application Let's start by setting up a simple VB.NET Console Application: Open Visual Studio and choose "Create a new project." Select "Console App" as the project template and click "Next." Configure the project settings and click "Next." In Additional information, select the latest .NET framework. Click "Create" to generate your VB.NET Generate QR Code application. Install IronQR Library using Solution Explorer With the project set up, click on Solution Explorer, and select Manage NuGet Packages for Solution. In the NuGet window, click the Browse tab and search for IronQR and click Install button. Implementing QR Code Generator in VB.NET In this QR code generation application, we'll showcase the simplicity and flexibility of generating QR Code using the IronQR library within a (Visual Basic) VB.NET Console Application. We begin with the most straightforward approach, creating a QR code with a default configuration. Then, we move to a more advanced QR Code example, customizing parameters such as the QR code's content, logo, size, and version. For more code examples, please visit QR code generator for .NET. Let's explore the below sample code snippet and understand how IronBarcode simplifies QR Code, barcode image generation in Visual Basic. Imports IronQr Imports IronSoftware.Drawing Imports Color = IronSoftware.Drawing.Color Module Program ' Simplest example of creating a QR Code with no settings Private qrImageSimple As AnyBitmap Sub Main(args As String()) ' Set your license key to remove watermarks IronQR.License.LicenseKey = "IronQR-MYLICENSE-KEY-1EF01" ' Simple QR Code generation Dim myQrCode As QrCode = QrWriter.Write("https://ironsoftware.com/") qrImageSimple = myQrCode.Save() qrImageSimple.SaveAs("simpleQRCode.png") ' Advanced Example to set all parameters ' Value for the QR code Dim value As String = "https://ironsoftware.com/" ' Set QR options like error correction level and margin Dim options As New QrOptions(QrErrorCorrectionLevel.High, 20) ' Create QR code with options Dim myQr As QrCode = QrWriter.Write(value, options) ' Adding a logo and defining style options Dim logoBmp As New AnyBitmap("VisualStudioLogo.png") Dim style As New QrStyleOptions With { .Dimensions = 300, .Margins = 10, .Color = Color.Gray, .Logo = New QrLogo With { .Bitmap = logoBmp, .Width = 100, .Height = 100, .CornerRadius = 2 } } ' Save advanced styled QR Code as a Bitmap Dim qrImageComplex As AnyBitmap = myQr.Save(style) qrImageComplex.SaveAs("complexQRCode.png") End Sub End Module Imports IronQr Imports IronSoftware.Drawing Imports Color = IronSoftware.Drawing.Color Module Program ' Simplest example of creating a QR Code with no settings Private qrImageSimple As AnyBitmap Sub Main(args As String()) ' Set your license key to remove watermarks IronQR.License.LicenseKey = "IronQR-MYLICENSE-KEY-1EF01" ' Simple QR Code generation Dim myQrCode As QrCode = QrWriter.Write("https://ironsoftware.com/") qrImageSimple = myQrCode.Save() qrImageSimple.SaveAs("simpleQRCode.png") ' Advanced Example to set all parameters ' Value for the QR code Dim value As String = "https://ironsoftware.com/" ' Set QR options like error correction level and margin Dim options As New QrOptions(QrErrorCorrectionLevel.High, 20) ' Create QR code with options Dim myQr As QrCode = QrWriter.Write(value, options) ' Adding a logo and defining style options Dim logoBmp As New AnyBitmap("VisualStudioLogo.png") Dim style As New QrStyleOptions With { .Dimensions = 300, .Margins = 10, .Color = Color.Gray, .Logo = New QrLogo With { .Bitmap = logoBmp, .Width = 100, .Height = 100, .CornerRadius = 2 } } ' Save advanced styled QR Code as a Bitmap Dim qrImageComplex As AnyBitmap = myQr.Save(style) qrImageComplex.SaveAs("complexQRCode.png") End Sub End Module VB .NET Let's break down the above source code for creating QR Code images step by step: 1. Imports Statement: Imports IronQr Imports IronSoftware.Drawing Imports Color = IronSoftware.Drawing.Color Imports IronQr Imports IronSoftware.Drawing Imports Color = IronSoftware.Drawing.Color VB .NET These lines import the necessary namespaces from the IronQR library, providing access to the classes and methods required for QR Code generation and styling. 2. Module Declaration Module Program Module Program VB .NET The Module keyword declares a module named "Program," encapsulating the code. A module is a container for organizing code in VB.NET. 3. Create QR Code - Simple Source Code Example: ' Simplest example of creating a QR Code with no settings: Dim myQrCode As QrCode = QrWriter.Write("https://ironsoftware.com/") qrImageSimple = myQrCode.Save() qrImageSimple.SaveAs("simpleQRCode.png") ' Simplest example of creating a QR Code with no settings: Dim myQrCode As QrCode = QrWriter.Write("https://ironsoftware.com/") qrImageSimple = myQrCode.Save() qrImageSimple.SaveAs("simpleQRCode.png") VB .NET Here, a simple QR code is created using the QrWriter.Write method with a URL ("https://ironsoftware.com/"). The result is stored in the myQrCode variable, which is then saved as an AnyBitmap image and saved as a PNG image file. 4. QR Code Creation - Advanced Example ' The value of the QR code as a string. Also suitable for URLs. Dim value As String = "https://ironsoftware.com/" ' Set QR options Dim options As New QrOptions(QrErrorCorrectionLevel.High, 20) ' Create a QR Code object Dim myQr As QrCode = QrWriter.Write(value, options) ' Fancy style options Dim logoBmp As New AnyBitmap("VisualStudioLogo.png") Dim style As New QrStyleOptions With { .Dimensions = 300, .Margins = 10, .Color = Color.Gray, .Logo = New QrLogo With { .Bitmap = logoBmp, .Width = 100, .Height = 100, .CornerRadius = 2 } } ' Save QR Code as a Bitmap Dim qrImageComplex As AnyBitmap = myQr.Save(style) qrImageComplex.SaveAs("complexQRCode.png") ' The value of the QR code as a string. Also suitable for URLs. Dim value As String = "https://ironsoftware.com/" ' Set QR options Dim options As New QrOptions(QrErrorCorrectionLevel.High, 20) ' Create a QR Code object Dim myQr As QrCode = QrWriter.Write(value, options) ' Fancy style options Dim logoBmp As New AnyBitmap("VisualStudioLogo.png") Dim style As New QrStyleOptions With { .Dimensions = 300, .Margins = 10, .Color = Color.Gray, .Logo = New QrLogo With { .Bitmap = logoBmp, .Width = 100, .Height = 100, .CornerRadius = 2 } } ' Save QR Code as a Bitmap Dim qrImageComplex As AnyBitmap = myQr.Save(style) qrImageComplex.SaveAs("complexQRCode.png") VB .NET In this advanced sample code example, we declare variables for customizing the QR Code. value holds the content of the QR code. We then set the QrErrorCorrectionLevel using the QrOptions class. The value and options are then passed to QrWriter.Write to generate the QR code. logoBmp holds the QR code logo image, and style defines its dimensions, margins, color, and logo properties. Finally, the image is saved as AnyBitmap with styling and then as a PNG image file. 5. Main Method Sub Main(args As String()) IronQR.License.LicenseKey = "IronQR-MYLICENSE-KEY-1EF01" ' License key setup removes watermarks qrImageSimple.SaveAs("simpleQRCode.png") qrImageComplex.SaveAs("complexQRCode.png") End Sub Sub Main(args As String()) IronQR.License.LicenseKey = "IronQR-MYLICENSE-KEY-1EF01" ' License key setup removes watermarks qrImageSimple.SaveAs("simpleQRCode.png") qrImageComplex.SaveAs("complexQRCode.png") End Sub VB .NET The Main method in a VB.NET Console Application is the entry point. It sets your license key to remove watermarks from the generated QR Code. It calls the SaveAs method to save the generated QR Code images as files ("simpleQRCode.png" and "complexQRCode.png"). Running the Console Application and View Output Execute the Console Application, and you should see a success message indicating that the QR Code has been generated and saved. Output of simple QR Code image: Output of complex QR code image: Conclusion This article demonstrated the generation of QR Codes using VB.NET and the IronQR library in a Console Application. By following the outlined steps, developers can easily integrate QR Code generation into their VB.NET projects, offering a quick and efficient way to encode information for various applications. Explore IronQR's documentation for additional customization options and features. IronQR is a versatile .NET library specializing in QR code operations. It enables QR Code generation, supports styled variations, and recognizes various QR code formats and types. The library excels in saving QR Codes to image formats like JPEG, PNG, BMP, TIFF, and GIF through the SaveAsImage() method, facilitating seamless integration and storage. For development purposes, IronQR is freely accessible but with a watermark. Commercial use requires a license for users to evaluate its full functionality. よくある質問 VB.NETを使用してコンソールアプリケーションでQRコードを作成する方法は? VB.NETでQRコードを作成するには、IronQRライブラリを使用します。Visual Studioでコンソールアプリケーションをセットアップし、NuGetパッケージマネージャーを介してIronQRをインストールした後、QrWriter.Writeメソッドを使用してQRコードを生成します。 VB.NETプロジェクトにIronQRライブラリをインストールする手順は? VB.NETプロジェクトにIronQRをインストールするには、Visual Studioを開き、ソリューションエクスプローラーで「ソリューションのNuGetパッケージを管理」を選択し、「参照」タブでIronQRを検索してインストールをクリックします。 VB.NETでQRコードをカスタマイズする方法は? VB.NETでのIronQRを使用したQRコードのカスタマイズは、エラー補正レベル、サイズの調整、ロゴの追加などで行えます。これはQrOptionsおよびQrStyleOptionsクラスを使用して行います。 VB.NETで生成されたQRコードを保存できる画像形式は? VB.NETでIronQRを使用して生成されたQRコードは、SaveAsImage()メソッドを使用することで、JPEG、PNG、BMP、TIFF、GIFなどのさまざまな画像形式で保存できます。 VB.NETを使用してQRコードにロゴを追加することは可能ですか? はい、QrLogoオブジェクトを作成し、ビットマップ、幅、高さ、コーナー半径などのプロパティをQrStyleOptionsクラス内で設定することにより、VB.NETでQRコードにロゴを追加できます。 IronQRで生成したQRコードから透かしを削除する手順は? IronQRで生成したQRコードから透かしを削除するには、VB.NETアプリケーション内でIronQR.License.LicenseKeyプロパティを設定してライセンスキーを適用します。 IronQRライブラリを商用アプリケーションで無料で使用できますか? IronQRは開発目的で透かし付きで無料で使用できます。商用利用には、透かしなしでライブラリを使用するためにライセンスを購入する必要があります。 VB.NETプロジェクトでQRコードを生成するための前提条件は何ですか? VB.NETプロジェクトでQRコードを生成する前に、システムにVisual Studioがインストールされていることと、NuGetパッケージマネージャーを介してプロジェクトにIronQRライブラリが追加されていることを確認してください。 Jordi Bardia 今すぐエンジニアリングチームとチャット ソフトウェアエンジニア Jordiは、最も得意な言語がPython、C#、C++であり、Iron Softwareでそのスキルを発揮していない時は、ゲームプログラミングをしています。製品テスト、製品開発、研究の責任を分担し、Jordiは継続的な製品改善において多大な価値を追加しています。この多様な経験は彼を挑戦させ続け、興味を持たせており、Iron Softwareで働くことの好きな側面の一つだと言います。Jordiはフロリダ州マイアミで育ち、フロリダ大学でコンピュータサイエンスと統計学を学びました。 関連する記事 更新日 9月 18, 2025 C#で画像からQRを読む方法 このガイドでは、高性能のQRコードライブラリIronQRを使って、C#コードを使って簡単に画像からQRコードを読み取る方法を説明します。 詳しく読む 更新日 8月 20, 2025 QRコードスキャナーのために.NET MAUIを使用する方法 この投稿では、IronQRを使って.NET MAUIバーコードスキャナーとQRコードリーダーを作成する方法を説明します。 詳しく読む 更新日 7月 28, 2025 Visual StudioでQRコードを生成する方法 また、Visual StudioのNuGetパッケージマネージャで「IronQR」を検索し、最新の安定バージョンを選択する方法もあります。 詳しく読む QRCoderを使ったQRコード生成と.NET 6でのIronQRの比較WiFi QRコードリーダーガイ...
更新日 9月 18, 2025 C#で画像からQRを読む方法 このガイドでは、高性能のQRコードライブラリIronQRを使って、C#コードを使って簡単に画像からQRコードを読み取る方法を説明します。 詳しく読む
更新日 8月 20, 2025 QRコードスキャナーのために.NET MAUIを使用する方法 この投稿では、IronQRを使って.NET MAUIバーコードスキャナーとQRコードリーダーを作成する方法を説明します。 詳しく読む
更新日 7月 28, 2025 Visual StudioでQRコードを生成する方法 また、Visual StudioのNuGetパッケージマネージャで「IronQR」を検索し、最新の安定バージョンを選択する方法もあります。 詳しく読む