Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim n As Integer
Dim j As Integer
Dim sum As Integer
n = TextBox1.Text
Do While n > 0
j = n Mod 10
sum += j
n /= 10
Loop
MsgBox(sum)
End Sub
End Class