how to calculate the check digit (EAN-13) barcode symbologies ?

Hi all friends,

(1 textbox and 1 command button)

pls help me write the code in VB6 into command button click event, when i click the command button the barcode and check digit will show on the textbox.

EXAMPLE
How to calculate the Check Digit
A check digit is the result of a mathematical calculation performed on the preceding digits in the number. It is used during scanning to verify that the barcode was correctly read.

This calculation, called the Modulo 10 algorithm, is the same for all GS1 primary identification numbers.

An example calculating the check digit
8 9 0 4 0 0 0 2 1 0 0 3 C (check digit position)

Perform the following calculation using the GTIN - 13 numbers from the example above.

1.Starting with the first number on the right, add all the alternate numbers
2. 3 + 0 + 2 + 0 + 4 + 9 = 18

3.Multiply the result by three.
18 x 3 = 54

4.Starting with the second number on the right, add all alternate numbers.
0 + 1 + 0 + 0 + 0 + 8 = 9

5.Add the results of steps two and three.
54 + 9 = 63

6.Add the number needed to bring the total to the next multiple of 10.
63 + 7 = 70

The number which you need to add to make it the next multiple of 10 is the check digit.

In our example the check digit is 7.

The complete number is: 890 4000 21003 7

thank u.