Create Barcodes in VB.NET WinForms
Step 1. Add a Reference to BarCodeWizFonts.Code128.dll
- Click on Project > Add Reference...
![](https://media.barcodewiz.com/images/f6ea8aaa-cb12-4d7d-b5f2-b2729cd53b14-vbnet1.png)
- Click Browse...
![](https://media.barcodewiz.com/images/17a28531-ca6f-489e-9b06-96c4525d3abd-csharp2.png)
- Locate BarCodeWizFonts.Code128.dll and click Add. The default location is:
C:\Program Files\BarCodeWiz\BarCodeWiz Code 128 Fonts\DotNet\net40 (use with .NET 4.0 or newer)
C:\Program Files\BarCodeWiz\BarCodeWiz Code 128 Fonts\DotNet\net20 (use with .NET 2.0 or newer)
![](https://media.barcodewiz.com/images/88a8b143-d0ba-4635-9ae4-f14e18a3ee80-dotNetBrowseReference_1.png)
Step 2. Add the following controls to your form:
- 1. TextBox (TextBox1) - text input, will be converted to barcode
- 2. Button (Button1) - to trigger the conversion. Set its Text property to "Encode"
- 3. Label (Label1) - to display the encoded barcode
![](https://media.barcodewiz.com/images/fda48c9a-b2bb-4c22-89cb-36f507de1121-vbnet2.png)
Step 3. Edit the label properties
- Set the Font to BCW_Code128B_2, 24pt
- Set UseMnemonic to False
![](https://media.barcodewiz.com/images/1998453e-f3df-4eb2-b651-149168eb39c1-vbnet3.png)
Step 4. Add code to convert the text to barcode
- Double-click on Button1 and add the following code in the Click event:
Dim encoder as New Code128Fonts
Label1.Text = encoder.Code128B(TextBox1.Text) - Add an Imports statement:
Imports BarCodeWizFonts.Code128
![](https://media.barcodewiz.com/images/236a57a5-7281-4049-9aef-62dd4390c788-vbnet4_1.png)
- The final result
![](https://media.barcodewiz.com/images/1e92366b-406e-4857-ae40-b838004d21e2-vbnet5.png)
See More
- To see a more advanced example of barcode printing and label formatting with Code 128 Barcode Fonts in VB.NET, open the project:
Documents\BarCodeWiz Examples\Code 128 Barcode Fonts\DotNet\VBNET
![](https://media.barcodewiz.com/images/b9b3e7ad-f740-4e0a-930f-a299b1c3dce3-vbnet6.png)