How To Create Barcode In Visual Studio
Preview
Hello friends, in this post I will discuss about how to create a barcode code with type 128A and QRCode. A barcode is an optical data set that reads a machine and contains data.
Previously, we need to download the required libabry file, visit this site, then click the download link as shown below
If the link is broken, click here
Next, open Visual Studio and create a new project, then design the form as shown below
NOTES :
Components in Form:
Now import libary. Right-click the project and select Add Reference. find and select Library file, then click OK. Next create a folder in the debug folder with the name Barcode, as a place to store the barcode code that will be created.Components in Form:
- 1 Label
- 2 Button
- 1 Textbox
- 2 PictureBox
When done, double-click the CODE 128A Button and enter the following code
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
If TextBox1.Text = "" Then
MessageBox.Show("Insert Your Code", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
Else
On Error Resume Next
Dim barcode As KeepAutomation.Barcode.Bean.BarCode = New KeepAutomation.Barcode.Bean.BarCode
barcode.Symbology = KeepAutomation.Barcode.Symbology.Code128A
barcode.CodeToEncode = TextBox1.Text
barcode.X = 1
barcode.Y = 60
barcode.BottomMargin = 10
barcode.TopMargin = 10
barcode.LeftMargin = 10
barcode.RightMargin = 10
barcode.DisplayText = True
barcode.Orientation = KeepAutomation.Barcode.Orientation.Degree0
barcode.BarcodeUnit = KeepAutomation.Barcode.BarcodeUnit.Pixel
barcode.DPI = 72
barcode.TextFont = New Font("Arial", 10.0F, FontStyle.Bold)
barcode.ImageFormat = System.Drawing.Imaging.ImageFormat.Jpeg
barcode.generateBarcodeToImageFile(Application.StartupPath & "\Barcode\" & TextBox1.Text & ".jpeg")
PictureBox1.Image = Image.FromFile(Application.StartupPath & "\Barcode\" & TextBox1.Text & ".jpeg")
End If
End Sub
MORE ARTICLE
How To Create Captcha Code VB.Net
Back to Form, double-click the QRCode Button and enter the following code
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
If TextBox1.Text = "" Then
MessageBox.Show("Insert Your Code", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
Else
On Error Resume Next
Dim barcode As KeepAutomation.Barcode.Bean.BarCode = New KeepAutomation.Barcode.Bean.BarCode
barcode.Symbology = KeepAutomation.Barcode.Symbology.QRCode
barcode.CodeToEncode = TextBox1.Text
barcode.X = PictureBox2.Width
barcode.Y = PictureBox2.Height
barcode.BottomMargin = 10
barcode.TopMargin = 10
barcode.LeftMargin = 10
barcode.RightMargin = 10
barcode.DisplayText = True
barcode.Orientation = KeepAutomation.Barcode.Orientation.Degree0
barcode.BarcodeUnit = KeepAutomation.Barcode.BarcodeUnit.Pixel
barcode.DPI = 72
barcode.ImageFormat = System.Drawing.Imaging.ImageFormat.Png
barcode.generateBarcodeToImageFile(Application.StartupPath & "\Barcode\" & TextBox1.Text & ".png")
PictureBox2.Image = Image.FromFile(Application.StartupPath & "\Barcode\" & TextBox1.Text & ".png")
End If
End Sub
Transitions
Over 1200 dynamic After Effects transitions for any video projects! Make your video visually interesting and amazing quickly, conveniently and effortlessly! Slideshow, trailer, promo, music clip, broadcast, movie, documentary film or presentation – every your project will be far more fascinating, dizzying, and professional!Get it Now
If all is done and there is no error, the program is ready to run