file.vb
Private Sub Command1_Click()
ans = display()
MsgBox ("Ansis "&ans)
End Sub
Public Function display() As Integer
s = 0
n = Val(Text1.Text)
While n > 9
s = 0
While n > 0
r = n Mod 10
s = s + r
n = n 10
Wend
n = s
Wend
display = s
End Function