by Kovac (1 Submission)
Category: Math/Dates
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Tue 30th January 2001
Date Added: Mon 8th February 2021
Rating: (1 Votes)
Control number - modul10
Dim a$
Dim i As Integer
Dim j(100) As Integer
Dim b$
Dim c As Integer
Dim p As Integer
Dim q$
Dim z As Integer
Dim d As Integer
Dim e$
Dim h As Integer
Dim Result As Integer
a$ = Text1
If a$ = "0" Then
Text2 = 0
Else
For i = 1 To Len(a$)
z = i Mod 2
j(i) = Val(Mid$(a$, i, 1))
b$ = j(i)
If (z = 1) Then
c = c + b$
Else
If b$ > 4 Then
p = b$ * 2
q$ = Val(p)
For d = 1 To Len(q$)
j(d) = Val(Mid$(q$, d, 1))
e$ = j(d)
h = h + e$
Next d
c = c + h
Else
c = c + (b$ * 2)
End If
End If
Next i
If c >= 10 Then
Result = c Mod 10
If Result = 0 Then
Text2 = 0
Else
Text2 = 10 - Result
End If
Else
Text2 = 10 - c
End If
End If
End Sub
Private Sub Command2_Click()
Text1 = ""
Text2 = ""
Text1.SetFocus
End Sub
Private Sub Command3_Click()
End
End Sub
Private Sub Text1_KeyPress(KeyAscii As Integer)
If (KeyAscii >= Asc("0") And KeyAscii <= Asc("9")) Or KeyAscii = vbKeyBack Then
Exit Sub
Else
KeyAscii = 0
End If
End Sub