473,659 Members | 2,980 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=((t his.dblLoanAmt* =this.dblIntere st)/= 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 1415
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.dblInteres t;

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.dblInteres t;
should be the same as:
this.dblLoanAmt = this.dblLoanAmt * this.dblInteres t;
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
3065
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 huge test classes, I started to think about splitting classes. Basically you have at least three obvious choises, if you are going for consistency in your test modules: Choise a:
10
1653
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 and then initialize the class in that file (one class per file, each file has the same name as the class). This code has been working fine for 8 months, and now is dying on this one line. Oddly, it is dying on the last return of this method. ...
1
1506
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 a subtle/grand difference between the two? For example here http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnbda/html/observerpattern.asp I read
5
3414
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 5), but fails on IIS 6 running on a Win2003 server. The web uses Pages derived from a custom class I wrote (which itself derives from Page) to provide some common functionality. The Page_Load handler the failing webpage starts out like this: ...
4
2844
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. '**************************************************************************** ' Issues '****************************************************************************
9
5993
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. I can get the calling assembly rather easily, but let's say within Assembly X I have class A
5
2172
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 is a code sample (which doesn't work): *** Begin code ***
2
1386
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') .... @classmethod .... def f(cls): .... print('class method')
43
2061
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 within main? (It just doesn't "feel" right to me). Example 1: class MyProg { public:
5
3734
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 wanna invoke in derived class method the base class event but i am facing an error there i am unable find the solution.canaby body tell me the solution.following is the code. using System; using System.Collections.Generic; using System.Linq;...
0
8335
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8747
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8627
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7356
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6179
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4175
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2752
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 we have to send another system
2
1976
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1737
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.