BarCode VB6 Code Sample to Draw Barcode to form HDC - ByteScout

VB6 Source Code Sample to Draw Barcode to form HDC

  • Home
  • /
  • Articles
  • /
  • VB6 Source Code Sample to Draw Barcode to form HDC

How to Draw Barcode to form HDC in Visual Basic 6 using ByteScout Barcode Generator SDK

Barcode – VB6 source code sample. This sample shows how to generate barcodes in Visual Basic 6 using Barcode Generator SDK.

ByteScout Barcode Generator SDK is a complete solution for all types of business, using bar code for their inventories. It empowers through adding multiple functionalists in client business tools. Above all, it is cost-effective relatively.

There are many benefits to using ByteScout Barcode Generator SDK such as it adding barcodes to a pdf document, it does not bound the user to connect with the internet during barcode generation, ByteScout provides the full document for the help of esteemed clients/users. It supports all 1D linear and 2D multi-dimensional barcodes including Maxi Code barcode, MicroQR (2D), Han Xin Code 2D. Also, Bytescout Barcode Generator SDK includes both components for desktop and web applications.

It’s very easy to embed mentioned code in your application and take full advantage of SDK. Please follow the steps:

  1. Initialize form with its parameters like height, width, position, etc or directly copy and paste the code from SDK.
  2. There is a point to be noted, while the declaration of Form1 (any name) must be auto redraw ‘True’. Because it will make all drawings visible.
  3. It’s time to create a Barcode object.
  4. Sequentially, here you will add properties of a created object such as what kind of barcode you are going to create like code39.
  5. Now set the encode value which will encode the information as per set code.
  6. Set the positioning value to barcode drawing on the form.
  7. Similarly, provide the above-mentioned properties for the second drawing which will show besides the first drawing.
  8. Copy the code and debug in your production environment and make your life easy at a minimal price.

VB 6 Module

(Form1.frm):

VERSION 5.00
Begin VB.Form Form1 
  AutoRedraw      =   -1  'True
  Caption         =   "Form1"
  ClientHeight    =   4845
  ClientLeft      =   45
  ClientTop       =   435
  ClientWidth     =   9795
  LinkTopic       =   "Form1"
  ScaleHeight     =   4845
  ScaleWidth      =   9795
  StartUpPosition =   3  'Windows Default
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Form_Load()

Set bc = CreateObject("Bytescout.BarCode.Barcode")

' set symbology type
bc.Symbology = 1 ' 1 = Code39

' set value to encode
bc.Value = "012345"
 
' draw code 39 barcode to the form at (0,0)
bc.DrawHDC hDC, 0, 0
 
' now drawing 2D Aztec barcode

' set symbology type
bc.Symbology = 17 ' 17 = Aztec
' set value to encode
bc.Value = "012345"

' draw 2D Aztec barcode to the form at (0,200)
bc.DrawHDC hDC, 0, 200

Set bc = Nothing

End Sub

Barcode Generation to form HDC

Barcode VB6 Generator

Tutorials:

prev
next