Private Sub printdc128_PrintPage(ByVal sender As System.Object, ByVal e As
System.Drawing.Printing.PrintPageEventArgs)
Dim img As System.Drawing.Image
Dim bc128 As New BarcodeLib.Barcode.Linear()
' Insert text
e.Graphics.DrawString(TextBox1.Text, New System.Drawing.Font("Arial", 16.0F), System.Drawing.Brushes.Black, New System.Drawing.PointF(10.0F, 10.0F))
' Select Code Type
bc128.Type = BarcodeLib.Barcode.BarcodeType.CODE128
' Select data source
bc128.Data = TextBox2.Text
' Choose Unit of Measures
bc128.UOM = BarcodeLib.Barcode.UnitOfMeasure.PIXEL
' Barcode Height and Width
bc128.BarHeight = 40.0
bc128.BarWidth = 2.0
' Convert text to stream
Dim bc128stream As New MemoryStream()
bc128.drawBarcode(bc128stream)
' Convert Stream to image
img = Drawing.Image.FromStream(bc128stream)
' Draw the image and Choose the coordinates(X,Y)
e.Graphics.DrawImage(img, New Drawing.PointF(10, 90))
End Sub