473,503 Members | 2,322 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Delegate CLass Method is not working

126 New Member
Hi Good Friends,
I encounter another problem while trying to use DELEGATE Class method to perform calculation to return the result to the Calling FORM FrmMain.cs

Here are the error message:
Error 1 The left-hand side of an assignment must be a variable, property or indexer

this is the coding that generate the above error
dblTotalAmt=((this.dblLoanAmt*=this.dblInterest)/= 100);

------------------------------------------------
Class Delegate Coding:
Expand|Select|Wrap|Line Numbers
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5.  
  6. namespace CSharpDelegate
  7. {
  8.  class ClassDelegateCalculate
  9.   {
  10.    //declare the DelegateCalculatonClass
  11.    public delegate double DelegateCalculate(double LoanAmt, double interest);
  12.  
  13.   //declare variables 
  14.   public  double dblLoanAmt;
  15.   public  double dblInterest;
  16.   public  double dblTotalAmt;
  17.  
  18.  //constructor override
  19.  public ClassDelegateCalculate(double Loan, double  YearInt)
  20.  {
  21.     this.dblLoanAmt = Loan;
  22.     this.dblInterest=YearInt;                                    
  23.  }
  24.  
  25.    //class methods - calculate interest on loan amount   
  26.    public  Double propCalculate()
  27.      //return variable back to calling Program
  28.    {                               
  29.     dblTotalAmt = (( this.dblLoanAmt *= this.dblInterest) /= 100);<--- error here    return (dblTotalAmt);  
  30.    }                                    
  31.     }
  32. }
  33.  
Sep 20 '10 #1
4 1404
Plater
7,872 Recognized Expert Expert
This really doesn't seem to have anything to do with delegates and methods.
Try spliting up your line, it will show you have an extra = sign
Expand|Select|Wrap|Line Numbers
  1. this.dblLoanAmt *= this.dblInterest;
  2. dblTotalAmt = ( this.dblLoanAmt/ 100);//note I do not use /=100
  3.  
Sep 20 '10 #2
lenniekuah
126 New Member
Hi Plater,
Regarding your sample coding I am confuse about this:
this.dblLoanAmt *= this.dblInterest;

Where about do you store the result of Multiplication ?
Sep 20 '10 #3
Plater
7,872 Recognized Expert Expert
Ahh, so you are just copy/pasting code and don't know what it is doing. I took that line right out of the code you posted.

this.dblLoanAmt *= this.dblInterest;
should be the same as:
this.dblLoanAmt = this.dblLoanAmt * this.dblInterest;
Sep 22 '10 #4
lenniekuah
126 New Member
Hullo Good Plater,
Thank you for your help. You are awesome and generous in helping. Appreciate your help very much. Also ZiadMalki is awesome and wonderful like you in helping me.

Thanks to both of you
Sep 23 '10 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

4
3047
by: Edvard Majakari | last post by:
Hi, I just found py.test and converted a large unit test module to py.test format (which is actually almost-no-format-at-all, but I won't get there now). Having 348 test cases in the module and...
10
1636
by: lkrubner | last post by:
I killed last night and a good chunk of today trying to figure out this one particular attempt to get a class and initialize it. My code is using a class method called getObject to include() a file...
1
1493
by: Taylor | last post by:
"Static" is synonymous with "class" with regards to members (methods and fields) right? Sometimes I hear refrence to the "static method" and sometimes its refered to a "static method." Is there...
5
3396
by: Nick Flandry | last post by:
I'm running into an Invalid Cast Exception on an ASP.NET application that runs fine in my development environment (Win2K server running IIS 5) and a test environment (also Win2K server running IIS...
4
2836
by: Ray Dukes | last post by:
What I am looking to do is map the implementation of interface properties and functions to an inherited method of the base class. Please see below. ...
9
5986
by: Steve | last post by:
Hello -- I've been struggling with this problem for over a day now. I'd like to know (without passing parameters) which class, and preferably, which method of that class has called my function....
5
2162
by: Len Weltman | last post by:
I am trying to pass a NumericUpDown object into a class method using Visual Studio 2005, but the control type is not found in Intellisense and the type declaration is flagged as an error. Here...
2
1377
by: Sylvain Ferriol | last post by:
hello can you explain why python does not see difference between instance method and class method, having the same name example .... def f(self): .... print('instance method')...
43
2039
by: Tony | last post by:
I'm working with GUI messaging and note that MFC encapsulates the message loop inside of a C++ class member function. Is this somehow inherently less robust than calling the message loop functions...
5
3720
by: furqi | last post by:
hi every body i write a code in c sharp in which i have made a base class and make an event there.Then i make a derived class and made an other event in that class. Now what i wanna do is that i...
0
7291
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7357
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
7012
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
5598
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5023
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
3180
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3171
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1522
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
748
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.