I am working on verifying Vin numbers and cannot figure out how to take my converted array, which is the result of the first sub and multiple each one of the numbers to set of weighted values.
For instance I have taken the VIN shown in the string below and converted it to this 41312348565041183, which is correct. Now I need to take each number in that string and multiply it like this:
1st Position * 8
2nd position * 7
3rd position * 6
4th position * 5
Would be
4 * 8 = 32
1 * 7 = 7
3 * 6 = 18
1 * 5 = 5
and so on. Here is the code I have so far. My trouble is in the CalcVin Sub.
VB Code:
Private Sub ConvertVin() Dim strVin As String = "4A3AK34Y5WE041183" Dim arrVin(16) As Char arrVin = strVin.ToCharArray Dim c As Char For Each c In arrVin txtResults.Text += CStr(VinAlphaConvert(c)) Next c End Sub Private Sub CalcVin() Dim strConVin As String = txtResults.Text Dim arrVin(16) As Integer arrVin(0) += arrVin(0) * 8 MessageBox.Show(CStr(arrVin(0))) 'Dim c As Char 'arrVin(0) += CChar(CStr(CInt(Val(c)) * 8)) ' I need to take each of the 17 integers and ' multiply them by a weight factor like this '1st = 8 10th = 9 '2nd = 7 11th = 8 '3rd = 6 12th = 7 '4th = 5 13th = 6 '5th = 4 14th = 5 '6th = 3 15th = 4 '7th = 2 16th = 3 '8th = 10 17th = 2 '9th = check digit




Reply With Quote