Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Sum
Message
 
To
29/06/2004 17:09:53
General information
Forum:
ASP.NET
Category:
Other
Title:
Re: Sum
Miscellaneous
Thread ID:
00918691
Message ID:
00918947
Views:
14
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
Alexandre Boudreault-Ferland
Chief Technology Officer
AZUR Technologies
http://www.xicommunity.ca
http://www.xiazur.com
http://endfunction.blogspot.com
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform