Bonjour à tous!!
ceci est mon premier message et ça commence bien!!
Voila en fait je suis sous vs 2005 et je crée une application winform.
J'ai creer une fonction afin de me calculer le nombre de couleurs sur plusieurs champs sachant qu'ils sont tous typé string :
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39
| Public Function FctCalcNbCoul(ByVal XRECT1 As String, ByVal XRECT2 As String, ByVal XRECT3 As String, ByVal XRECT4 As String, ByVal XRECT5 As String, ByVal XRECT6 As String, ByVal XVERS1 As String, ByVal XVERS2 As String, ByVal XFONDCHQ As String) As Integer
Dim NbCoul As Integer
Dim cpt As Integer
cpt = 0
If XRECT1 <> " " Then '''j'ajoute 1 au compteur si champ pas vide
cpt = cpt + 1
If XRECT2 <> " " Then
cpt = cpt + 1
If XRECT3 <> " " Then
cpt = cpt + 1
If XRECT4 <> " " Then
cpt = cpt + 1
If XRECT5 <> " " Then
cpt = cpt + 1
If XRECT6 <> " " Then
cpt = cpt + 1
If XVERS1 <> " " Then
cpt = cpt + 1
If XVERS2 <> " " Then
cpt = cpt + 1
End If
End If
End If
End If
End If
End If
End If
End If
XFONDCHQ = XFONDCHQ.Remove(0, 3)
XFONDCHQ = XFONDCHQ.Remove(5, 9)
NbCoul = CInt(XFONDCHQ) + cpt
Return NbCoul
End Function |
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
ensuite j'ajoute une nouvelle colonne à ma datatable et j'utilise la fonction de cette manière :
oTable.Columns.Add("Nb Couleur", Type.GetType("System.Int32"), "FctCalcNbCoul(XRECT1_0, XRECT2_0, XRECT3_0, XRECT4_0, XRECT5_0, XRECT6_0, XVERS1_0, XVERS2_0, XFONDCHQ_0)")
Mais ô problème de mer noire un message d'erreur trop cool apparait :
----------------
L'expression contient un appel de fonction non défini FctCalcNbCoul()
---------------
Merci d'avance pour votre aide!
Partager