i'm trying to calculate the check digit for a scan line. my problem is it needs to be weighted 2121, right to left. so what i have to do is take each character in the string and convert it to it's ASCII equivalent then multiply that by either a 2 or 1 depending on the position of the character. how can i alternate the 2 to a 1 after each character?
Code:Dim Product As Integer Dim SumOfProducts As Integer For Each row As DataRow In Table.Rows For Each ch As Char In row("PRESCAN").ToString Product = Asc(ch) * 2 SumOfProducts = SumOfProducts + Product Next row("CHKDGT") = SumOfProducts Mod 10 Next DataAdapter.Update(Table)




Reply With Quote