Question Problem to Convert a Javascript GTIN calculate function

tkinin

New member
Joined
Aug 15, 2010
Messages
1
Programming Experience
1-3
Hello,

I am not able to convert this function to VB code....

This is the javascript function to get the last digit of a GTIN number:

factor = 3;
sum = 0;

var gNum = '1234564020233'

for (index = gNum; index > 0; --index) {
sum = sum + gNum.substring(index - 1, index) * factor;
factor = 4 - factor;
}
cc = ((1000 - sum) % 10);

result = gNum + cc;

}


I have the problem to deal with the substring function.

Anyone can help?
 
Back
Top