Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Sum
Message
 
À
29/06/2004 17:09:53
Information générale
Forum:
ASP.NET
Catégorie:
Autre
Titre:
Re: Sum
Divers
Thread ID:
00918691
Message ID:
00918947
Vues:
13
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
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform