Click here to Skip to main content
15,936,633 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

When I implement my method CreationPaiementWCF, i get this error:

Error:
Operator '.' cannot be applied to operand of type 'void'

Code
C#
public retour AnnulerPaiementWCF(ref int CodePai, ref DateTime DatePai, ref string TypePai, ref int IdPiecePai, ref decimal MontantPai, ref int IndicatPai, ref DateTime DateVersement, ref DateTime DateLimPai)
       {
           Service1 ser = new Service1();
           retour rt = new retour();


           if (ser.AnnulerPaiement(CodePai, DatePai, TypePai, IdPiecePai, MontantPai, IndicatPai, DateVersement, DateLimPai).Equals(-1))
           {
               try
               {
                   rt.CodeRetour = -1;

                   rt.msgRetour = "Annulation paiement échouée";
               }
               catch (Exception e)
               {
                   CreateLog log = new CreateLog(e);
                   log.ErrorLog(@"C:\Documents and Settings\Administrateur\Bureau\fichierLog.txt");
               }
               return rt;

           }
           else
           {
               rt.CodeRetour = 0;
               rt.msgRetour = "Annulation paiement réussite";

               return rt;
           }

       }

Please help me :(
Posted
Updated 2-Jun-10 0:04am
v2
Comments
Arindam Tewary 2-Jun-10 5:54am    
Hi
Can you please mark the line where you are getting the error?

I am sure that ser.AnnulerPaiement method return nothing [its return type is void] and your code expecting a int from that method. Either change the return type of the method from void to int or remove the if check.
 
Share this answer
 
Comments
William Winner 2-Jun-10 12:08pm    
If you are going to test whether it returns true or false, then you have to set the method to either an int or bool. But you also will have to return a value within that method.
You need to post code for CreationPaiementWCF. Something may be wrong in the way you are calling AnnulerPaiementWCF from CreationPaiementWCF.
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900