Conversion de visual basic vers windev

Signaler
Messages postés
16
Date d'inscription
dimanche 8 mai 2011
Statut
Membre
Dernière intervention
27 mars 2013
-
Messages postés
1263
Date d'inscription
mardi 11 novembre 2003
Statut
Membre
Dernière intervention
24 juillet 2013
-
Option Compare Database

Public Function lettre(a As Double) As String
Select Case a
Case 0
lettre = Chr(32)
Case 1
lettre = "Un"
Case 2
lettre = "Deux"
Case 3
lettre = "Trois"
Case 4
lettre = "Quatre"
Case 5
lettre = "Cinq"
Case 6
lettre = "Six"
Case 7
lettre = "Sept"
Case 8
lettre = "Huit"
Case 9
lettre = "Neuf"
Case 10
lettre = "Dix"
Case 11
lettre = "Onze"
Case 12
lettre = "Douze"
Case 13
lettre = "Treize"
Case 14
lettre = "Quatorze"
Case 15
lettre = "Quinze"
Case 16
lettre = "Seize"
Case 17 To 19
lettre = lettre(10) & Chr(32) & lettre(a - 10)
Case 20
lettre = "Vingt"
Case 30
lettre = "Trente"
Case 40
lettre = "Quarante"
Case 50
lettre = "Cinquante"
Case 60
lettre = "Soixante"
Case 70
lettre = "Soixante Dix"
Case 80
lettre = "Quatre Vingt"
Case 90
lettre = lettre(a - 10) & Chr(32) & lettre(10)
Case 21, 31, 41, 51, 61
lettre = lettre(Int(a / 10) * 10) & Chr(32) & "et" & Chr(32) & lettre(1)
Case 22 To 29, 32 To 39, 42 To 49, 52 To 59, 62 To 69, 81 To 89
lettre = lettre(Int(a / 10) * 10) & Chr(32) & lettre(a - Int(a / 10) * 10)
Case 71
lettre = " soixante et onze"
Case 72 To 79, 91 To 99
lettre = lettre((Int(a / 10) * 10) - 10) & Chr(32) & lettre(a - (Int(a / 10) * 10 - 10))
Case 100
lettre = "Cent"
Case 200, 300, 400, 500, 600, 700, 800, 900
lettre = lettre(a / 100) & Chr(32) & lettre(100)
Case 101 To 199, 201 To 299, 301 To 399, 401 To 499, 501 To 599, 601 To 699, 701 To 799, 801 To 899, 901 To 999
lettre = lettre(Int(a / 100) * 100) & Chr(32) & lettre(a - Int(a / 100) * 100)
Case 1000
lettre = "un million "
Case 1000 To 999999

lettre = lettre(Int(a / 1000)) & Chr(32) & "Million" & Chr(32) & lettre(a - Int(a / 1000) * 1000) & Chr(32) & "Mille"


End Select


End Function

Function arretlettre(z As Currency) As String
Dim X, a, ss, b3 As Integer
On Error GoTo erreur
If z = 0 Then
arretlettre = " "

Else
X = Int(z)
a = Int(Int(z) / 1000)
b1 = lettre(Int(X / 1000))
b2 = lettre(X - Int(X / 1000) * 1000)
b33 = lettre(X - 100 * Int(X / 100))
b3 = Int(Int(X / 1000) / 1000)
b4 = 1000 * (z - X)
Select Case a
Case 0
If b4 = 0 Then
arretlettre = lettre(Int(z)) & Chr(32) & "Dinars"
Else
arretlettre = lettre(Int(z)) & Chr(32) & "Dinars et" & Chr(32) & b4 & Chr(32) & "Millimes"

End If
Case 1
If b4 = 0 Then
arretlettre = "Mille" & Chr(32) & lettre(Int(z) - 1000) & Chr(32) & "Dinars"
Else
arretlettre = "Mille" & Chr(32) & lettre(Int(z) - 1000) & Chr(32) & "Dinars et" & Chr(32) & b4 & Chr(32) & "Millimes"

End If
Case 2 To 999
If b4 = 0 Then
b5 = b1 & Chr(32) & "Mille" & Chr(32) & b2 & Chr(32) & "Dinars"
arretlettre = b5
Else
b5 = b1 & Chr(32) & "Mille" & Chr(32) & b2 & Chr(32) & "Dinars" & Chr(32) & b4 & Chr(32) & "Millimes"
arretlettre = b5
End If
Case 1000
If b4 = 0 Then
b5 = "Un Million de dinars"
arretlettre = b5
Else
b5 = "Un Million de dinars" & Chr(32) & b4 & Chr(32) & "Millimes"
arretlettre = b5
End If
Case 1001 To 999999
If b4 = 0 Then
b5 = b1 & Chr(32) & b2 & Chr(32) & "Dinars"
arretlettre = b5
Else
b5 = b1 & Chr(32) & b2 & Chr(32) & "Dinars" & Chr(32) & b4 & " Millimes"
arretlettre = b5
End If
End Select
Exit Function
erreur:
MsgBox "chiffre trop long pour la fonction", vbOKOnly, "arrete lettre"
Exit Function
End If

End Function




Sub alettr()
MsgBox arrete_lettreA(112236.998)


End Sub

1 réponse

Messages postés
1263
Date d'inscription
mardi 11 novembre 2003
Statut
Membre
Dernière intervention
24 juillet 2013
6
bonjour
oh puis non
Lis le règlement d'abord

La théorie, c'est quand on sait tout et que rien ne fonctionne. La pratique, c'est quand tout fonctionne et que personne ne sait pourquoi.

GRENIER Alain