Hello Mohammed,
in VB.NET, you can do something like this :
TextBox2.Text = SumStringChars(TextBox1.Text)
Function SumStringChars(ByVal strStringToSum As String) As Integer
Dim chrCharToSum As Char
Dim i As Integer
Dim intResult As Integer = 0
Try
For i = 0 To strStringToSum.Length - 1
chrCharToSum = strStringToSum.Chars(i)
If Not Char.IsDigit(chrCharToSum) Then
Throw New ArgumentException
End If
intResult += Val(chrCharToSum)
Next
Return intResult
Catch ex As Exception
Throw
End Try
End Function
Hope that helps!
Alex