CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Dec 2011
    Posts
    73

    [RESOLVED] More Than One Operator "+" Matches These Operands

    Hi,
    I have a small project in vc++ 2015. While I calculate the total, I get this error.
    Is it possible to solve this error. Any Kind helps.
    Code:
    private: static System::Decimal MyNumber2;
     private: static System::Decimal DJSubTot = 0;
     private: static System::Decimal DJVATTot = 0;
     private: static System::Decimal DJFreightTot = 0;
    
     MyNumber2 = 0; 
     if(Decimal::TryParse(textBox8->Text->Trim(), MyNumber2)){
        DJVATTot = MyNumber2;
     }
     MyNumber2 = 0;
    if (Decimal::TryParse(textBox9->Text->Trim(), MyNumber2)) {
        if (MyNumber2>0) {
            DJFreightTot = MyNumber2;
        }
    }
    textBox10->Text = (DJSubTot + DJVATTot + DJFreightTot).ToString(); // Error Line
    Thanks

  2. #2
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,395

    Re: More Than One Operator "+" Matches These Operands

    Try to look at the System::Decimal method operator+().
    Perhaps, it would give you some hints...
    Last edited by VictorN; April 13th, 2018 at 01:36 PM.
    Victor Nijegorodov

  3. #3
    Join Date
    Dec 2011
    Posts
    73

    Re: More Than One Operator "+" Matches These Operands

    Thank Victor
    The following code solves the error()
    Code:
    textBox10->Text = Convert::ToString(Decimal::Add(Decimal::Add(DJSubTot, DJVATTot), DJFreightTot));

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured