Need Help with an error

Cannot convert method group 'Calculate' to non-delegate type

Page 1 of 1

3 Replies - 2356 Views - Last Post: 22 March 2010 - 12:04 PM Rate Topic: ***-- 2 Votes

#1 mattiboi   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 21
  • Joined: 02-January 10

Need Help with an error

Posted 21 March 2010 - 07:55 PM

Im creating a Method that calculates the rental fee in my app


and this is what the compiler kicked back at me

Error 1 Cannot convert method group 'Calculate' to non-delegate type 'double'. Did you intend to invoke the method? C:\Users\St3aLtHy\Desktop\Movierental3\Movierental3\FrmMovieRental3.cs 263 20 MovieRental3


// 
//Matt Iwan 
//CSC-236001 
// Movie Rental Program 2 
// Add A Store Summary and Rental Summary to calculate the  
// Amount Due Tax, After Discount Income and # of Customers Served 



using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace MattIwanRentalStore
{
    public partial class FrmMovieRental3 : Form
    {
        public FrmMovieRental3()
        {
            InitializeComponent();


        }

        /* Proj3changes & Calculation Steps 
         *  
         * Movie Rental Amount will Now display the cost of the format when Radio Buttons are selected and add's New Release 
         *  
         * -Calculation Steps- 
         * gbRentalSummary Calculation: 
         *  
         * 1.RentalAmount[lblRentAmt] Displays Amount from format and New release(If checked) 
         * 2. Add A Total Amount from Selected Format & Movie Quantity (SubTotal) A.K.A Before Discount Cost 
         * 3.If user enters a Member #, It will check the is Member CB and Discount will apply 
         * 4.Final Cost will Be Displayed With/Without Discount 
         *  
         *     -Store Income- 
         *     5. Total customers[lblTotCost] - is determined by the Calculate Click Event| Increments per click [vCustServed] 
         *     6. Store Income[lblStoreIncome] - Lifetime view of Order income (After Discount)| Added from: [vStoreIncome] 
         */

        //Arrays 

        // Movie Name 

        //Format 

        //RentAmount 

        //Constants 
        const double CDISCOUNT = .10d;
        const double CMOVDVD = 4.50d;
        const double CMOVBD = 5.00d;
        const double CNEWRELEASE = 1.00d;
        //Variables 
        int vCustServd = 0;
        double vAmtDue = 0;
        double vStoreIncome = 0;
        double vRentalTotal = 0;
        int vMovieQuant = 0;
        double vAddNewRelease = 1.00d;
        //Project3 Variables 
        double vSubTotal = 0d;
        string txtScratch = " ";
        string so = " ";

        bool BDMovietype = true;
        bool Member = true;
        bool NewRelease = true;
        bool DVDMovietype = true;





        private void btnSubmit_Click(object sender, EventArgs e)
        {





            if (txtSearch.Text == string.Empty)
            {
                MessageBox.Show("You need to enter a movie title", "Missing Characters");

            }
            else
            {
                vMovieQuant += 1;
                lblMovieQuant.Text = vMovieQuant.ToString();
                MessageBox.Show("Request Accepted");


                txtSearch.Text = string.Empty;
            }


            //Sub Total 

            vSubTotal = vRentalTotal;

            lblSubTotal.Text = vSubTotal.ToString("C");

        }

        // ***Disabled*** 
        /* private void btnClear_Click(object sender, EventArgs e) 
         { 
 
             txtSearch.Clear(); 
             vMovieQuant -= 1; 
             lblMovieQuant.Text = vMovieQuant.ToString(); 
         } 
         */
        private void btnAbout_Click(object sender, EventArgs e)
        {
            MessageBox.Show("Matt Iwan CSC 236-001 Movie Rental Project");
        }

        private void btnExit_Click(object sender, EventArgs e)
        {
            Application.Exit();

        }

        private void btnCalculate_Click(object sender, EventArgs e)
        {



            //Rental Amount 
            // 1.Displays Format & New release( If Checked) Cost 






            //2. Total of Selected Movies(SubTotal) 
            // DVD || BD * MovieQuant 








            //Discount 
            lblDiscount.Text = CDISCOUNT.ToString("P");





            // Total Amount 

            vAmtDue = vRentalTotal;

            lblTotal.Text = vRentalTotal.ToString("C");


            //Store GroupBox 
            //Customers Served 
            
            
            

            vCustServd += 1;
            

            lblTotCust.Text = vCustServd.ToString();

            //Store Income 
            vStoreIncome = vRentalTotal;

            lblStoreIncome.Text = vStoreIncome.ToString("C");


        }

        private void btnSumClear_Click(object sender, EventArgs e)
        {
            lblMovieQuant.Text = null;
            lblDiscount.Text = null;
            lblRentalAmt.Text = null;
            lblTotal.Text = null;
            lblStoreIncome.Text = null;
            lblTotCust.Text = null;
            lblSubTotal.Text = null;


        }




        private double Calculate (bool BDMovietype,
                                   bool DVDMovietype,
                                   bool Member,
                                   bool NewRelease)
            
    { 
     
        
            
                        
            
BDMovietype = rbBluRay.Checked; 
DVDMovietype = rbDVD.Checked;
    
    Member = cbIsMember.Checked;
     NewRelease= cbNewRelease.Checked;

     
            
            if (DVDMovietype == true)
     {
         vRentalTotal = CMOVDVD;

         

     }

     else if (BDMovietype == true)
     {
         vRentalTotal = CMOVBD;

         

         


     }
     else
     {

     }

            if(Member == true)

            {
                vAmtDue = vRentalTotal * CDISCOUNT;
                vAmtDue = vRentalTotal - vAmtDue;
                
               
            }

            if (NewRelease == true)
            {
                vAddNewRelease = vRentalTotal += CNEWRELEASE;

               


            }
            return Calculate;
    }
       

        private void rbDVD_CheckedChanged(object sender, EventArgs e)
        {
            RadioButton rbDVD = (RadioButton)sender;
            
             lblRentalAmt.Text = CMOVDVD.ToString("C");


        }

        private void rbBluRay_CheckedChanged(object sender, EventArgs e)
        {
            RadioButton rbBluRay = (RadioButton)sender;
            
             lblRentalAmt.Text = CMOVBD.ToString("C");

        }

        private void cbNewRelease_CheckedChanged(object sender, EventArgs e)
        {
            
             lblRentalAmt.Text = vAddNewRelease.ToString("C");
        }

        private void cbIsMember_CheckedChanged(object sender, EventArgs e)
        {




            if (cbIsMember.Checked)
            {

                lblTotal.Text = vAmtDue.ToString("C");
                lblDiscount.Visible = true;
                cbIsMember.Enabled = false;

            }





        }

        private void btnOrdCom_Click(object sender, EventArgs e)
        {


            if (MessageBox.Show("Confirm", "Confirm") == DialogResult.OK)
            {
                MessageBox.Show("Thankyou");
            }





            //If btnOrdCom is clicked then cbIsMember enabled and unchecked 
            if (cbIsMember.Enabled == false)
            {
                cbIsMember.Enabled = true;
                cbIsMember.Checked = false;

                lblMovieQuant.Text = null;
                lblDiscount.Text = null;
                lblRentalAmt.Text = null;
                lblTotal.Text = null;
                lblStoreIncome.Text = null;
                lblTotCust.Text = null;
                lblSubTotal.Text = null;
                txtSearch.Text = string.Empty;
                cbNewRelease.Checked = false;
                rbDVD.Checked = false;
                rbBluRay.Checked = false;

            }

        }

        private void BtnClrNxt_Click(object sender, EventArgs e)
        {

            txtSearch.Text = string.Empty;
            cbNewRelease.Checked = false;
            rbDVD.Checked = false;
            rbBluRay.Checked = false;
        }








    }







}








I posted a horrible topic on this last time and basicly said nothing...

but I was being a lil emo last time lol

The method thats giving me trouble is the Calculate method above the Bluray Check_Changed Method


Thanks for your help in advanced

Is This A Good Question/Topic? 0
  • +

Replies To: Need Help with an error

#2 FlashM   User is offline

  • D.I.C Lover
  • member icon

Reputation: 383
  • View blog
  • Posts: 1,195
  • Joined: 03-December 09

Re: Need Help with an error

Posted 22 March 2010 - 12:29 AM

The problematic line is this one: return Calculate;

Your Caltulate method has 4 bool input paramters. You need to pass those 4 bool parameters to a method and that's why you get this exception thrown...
Was This Post Helpful? 2
  • +
  • -

#3 mattiboi   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 21
  • Joined: 02-January 10

Re: Need Help with an error

Posted 22 March 2010 - 10:06 AM

Sweet, good to know...

I had a feeling it was something like that. I just hate interpreting the compiler... I wish there was a tutorial for just that.
Was This Post Helpful? 0
  • +
  • -

#4 FlashM   User is offline

  • D.I.C Lover
  • member icon

Reputation: 383
  • View blog
  • Posts: 1,195
  • Joined: 03-December 09

Re: Need Help with an error

Posted 22 March 2010 - 12:04 PM

No problem... We're here to help you out, when stuck :-)
Was This Post Helpful? 1
  • +
  • -

Page 1 of 1