Visual Basic .Net Programming How to Create EAN-13 Barcode Generator


Visual Basic .Net (VB.Net) Programming How to Create EAN-13 Barcode Generator {Source Code}.

🎓 Master Visual Basic .NET and Access Database By Building the Point Of Sale System (POS).
📲 Enroll Now: https://bit.ly/2WcbRhX

📝 Please note that:
📌 The first version of this program written in C# language, I converted to VB .NET version for people who can't write C#.

👨‍💻 Here is my online course: Visual Basic .NET (VB.NET), Access Database and Crystal Reports Course.
🎯 Enroll now (Full lifetime access): http://bit.ly/2YRy99d

KEEP LEARNING AND HAPPY CODING!

THANK YOU VERY MUCH.

Visual Studio 2015
✅ VB.Net version: How to Create EAN 13 Barcode Generator.
» https://youtu.be/VTKS6f0RheU

Visual Studio 2015
✅ C Sharp version: C# How to Create EAN 13 Barcode Generator.
» https://youtu.be/6zo133qcu_Y

Visual Studio 2017 : Windows Forms Application.
✅ VB .Net & C# (Preview) Generating and Printing EAN-13 Barcodes in Crystal Reports.
» https://youtu.be/fjz3XroBmGo

Visual Studio 2017 : Windows Presentation Foundation (WPF).
✅  : C# (Preview) Generating and Printing EAN-13 Barcodes in Crystal Reports.
» https://youtu.be/KWlZE7WLJ7Y
✅ Visual Basic .Net (Preview) Generating and Printing EAN-13 Barcodes in Crystal Reports.
» https://youtu.be/s6tVYsOU2uA

📌 Calculate a check digit online at https://www.gs1.org/services/check-digit-calculator
(ตรวจสอบความถูกต้องของ Barcode โดยใช้ Check Digit)

[Screenshot-1] How to Create EAN-13 Barcode Generator (Visual Studio 2015).


[Screenshot-2] How to Create EAN-13 Barcode Generator (Visual Studio 2017).


[Screenshot-3] Generating and Printing EAN 13 Barcodes in Crystal Reports.


[Screenshot-4] How to calculate a check digit (EAN-13 Barcode)


[Screenshot-5] Generating and Printing EAN 13 Barcodes in Crystal Reports.


[Screenshot-6] Visual Studio 2017 : C# WPF Application (Preview) Generating and Printing EAN-13 Barcodes in Crystal Reports.


[YouTube] How to Create EAN-13 Barcode Generator (Visual Studio 2015).


[Sample Source Code]

Module: ChangeTextColor.vb

Module ChangeTextColor

Public Sub ChangeCirtainText(rt As RichTextBox, Start As Int16, Optional Length As Byte = 1)

        With rt
                 .SelectionAlignment = HorizontalAlignment.Left
                 .SelectionStart = Start
                 .SelectionLength = Length
                 .SelectionColor = Color.Crimson
        End With

End Sub

End Module

Module: EAN13Mod.vb

Imports System.Text.RegularExpressions

Module EAN13Mod

Public Barcode13Digits As String

Public Function EAN13(ByVal chaine As String) As String

        Dim i As Int32
        Dim first As Int32
        Dim checksum As Int32 = 0
        Dim EAN13Barcode As String = ""
        Dim tableA As Boolean

        Dim m As Boolean = Regex.IsMatch(chaine, "^\d{12}$")

        If (m) Then

            For i = 1 To (12 - 1) Step 2
                System.Diagnostics.Debug.WriteLine(chaine.Substring(i, 1))
                checksum += Convert.ToInt32(chaine.Substring(i, 1))
            Next

            checksum *= 3

            For i = 0 To (12 - 1) Step 2
                checksum += Convert.ToInt32(chaine.Substring(i, 1))
            Next

            chaine &= (10 - checksum Mod 10) Mod 10
            Barcode13Digits = chaine.ToString()

            EAN13Barcode = chaine.Substring(0, 1) + Convert.ToChar(65 + Convert.ToInt32(chaine.Substring(1, 1)))
            first = Convert.ToInt32(chaine.Substring(0, 1))

            For i = 2 To 6

                tableA = False

                Select Case i
                    Case Is = 2
                        If (first >= 0 And first <= 3) Then tableA = True
                    Case Is = 3
                        If (first = 0 Or first = 4 Or first = 7 Or first = 8) Then tableA = True
                    Case Is = 4
                        If (first = 0 Or first = 1 Or first = 4 Or first = 5 Or first = 9) Then tableA = True
                    Case Is = 5
                        If (first = 0 Or first = 2 Or first = 5 Or first = 6 Or first = 7) Then tableA = True
                    Case Is = 6
                        If (first = 0 Or first = 3 Or first = 6 Or first = 8 Or first = 9) Then tableA = True
                End Select

                If (tableA) Then
                    EAN13Barcode &= Convert.ToChar(65 + Convert.ToInt32(chaine.Substring(i, 1)))
                Else
                    EAN13Barcode &= Convert.ToChar(75 + Convert.ToInt32(chaine.Substring(i, 1)))
                End If

            Next

            EAN13Barcode &= Convert.ToChar("*")

            For i = 7 To 12
                EAN13Barcode += Convert.ToChar(97 + Convert.ToInt32(chaine.Substring(i, 1)))
            Next

            EAN13Barcode += Convert.ToChar("+")

        End If

        Return EAN13Barcode

    End Function

End Module

Form: Form1.vb

Imports System.Threading.Tasks
Imports System.Windows.Forms

Public Class Form1

Private Sub textBox1_TextChanged(sender As Object, e As EventArgs) Handles textBox1.TextChanged

        Dim Barcode, Check12Digits As String

        If Not (String.IsNullOrEmpty(textBox1.Text)) Then

            Check12Digits = textBox1.Text.PadRight(12, CChar("0"))
            Barcode = EAN13(Check12Digits)
            label1.Text = Barcode

            If Not (String.IsNullOrEmpty(Barcode13Digits)) And
               Not Barcode13Digits = "" Then

                RichTextBox1.Text = Barcode13Digits.Trim.ToString()

                'Change Colour Of Certain Text In A RichTextBox.
                Dim intStart As Int16 = Convert.ToInt16(RichTextBox1.TextLength - 1)
                ChangeCirtainText(RichTextBox1, intStart)

            End If

        End If

    End Sub

End Class


📝 FOLLOW ME ON 

Twitter
📌 https://twitter.com/#!/IBasskung

Facebook ಠ_ಠ
📌 https://www.facebook.com/CodeAMinute

Facebook (✪ω✪)
📌 https://www.facebook.com/IbasskungTutorial

Facebook ఠ_ఠ
📌 https://www.facebook.com/IbasskungGuitar

Google+
📌 http://google.com/+iBasskung

📌 https://plus.google.com/u/0/107523775437712370629/posts

YouTube Channel
📌 https://www.youtube.com/c/iBasskung

Dailymotion Channel
📌 http://www.dailymotion.com/Ibasskung-Courses

Free Source Code can be found here:
https://goo.gl/UNNzp2

Thank you very much.

#VBNet #Programming #CodeAMinute #iBasskungTutorial #EAN13 #BarcodeGenerator #RetailPOS substring c# Substring vb.net

Comments

Post a Comment