Can any boby explain to me in simple english why this I get this error "Compiler Error CS0118" I'm a beginner about to throw my machine out the window!!! Below is the code for my Calcultor & the code for the DLL i'm using!!!!

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


namespace WindowsApplication1
{
    public partial class Form1 : Form
    {

        calc Calculator = new calc();     


        int func;
        float a;
        float b;




        public Form1()
        {
            InitializeComponent();
        }

        private void btn_Zero_Click(object sender, EventArgs e)
        {
            lb_Display.Text = lb_Display.Text + "0"; // sends 0 to lb_Display
        }

        private void btn_One_Click(object sender, EventArgs e)
        {
            lb_Display.Text = lb_Display.Text + "1"; // sends 1 to lb_Display
        }

        private void btn_Two_Click(object sender, EventArgs e)
        {
            lb_Display.Text = lb_Display.Text + "2"; // sends 2 to lb_Display
        }

        private void bnt_Three_Click(object sender, EventArgs e)
        {
            lb_Display.Text = lb_Display.Text + "3"; // sends 3 to lb_Display
        }

        private void bnt_Four_Click(object sender, EventArgs e)
        {
            lb_Display.Text = lb_Display.Text + "4"; // sends 4 to lb_Display
        }

        private void btn_Five_Click(object sender, EventArgs e)
        {
            lb_Display.Text = lb_Display.Text + "5"; // sends 5 to lb_Display
        }

        private void btn_Six_Click(object sender, EventArgs e)
        {
            lb_Display.Text = lb_Display.Text + "6"; // sends 6 to lb_Display
        }

        private void btn_Seven_Click(object sender, EventArgs e)
        {
            lb_Display.Text = lb_Display.Text + "7"; // sends 7 to lb_Display
        }

        private void btn_Eight_Click(object sender, EventArgs e)
        {
            lb_Display.Text = lb_Display.Text + "8"; // sends 8 to lb_Display
        }

        private void bnt_Nine_Click(object sender, EventArgs e)
        {
            lb_Display.Text = lb_Display.Text + "9"; // sends 9 to lb_Display
        }

        private void btn_Clear_Click(object sender, EventArgs e)
        {
            lb_Display.Text = " ";  // clears Text in lb_Display
            lb_Memory.Text = " ";  // clears Text in lb_Memory

        }

        private void Btn_Plus_Click(object sender, EventArgs e)
        {


            func = 1;
            lb_Memory.Text = lb_Display.Text;  // sends text lb_Display to lb_Memory
            lb_Display.Text = " ";  //clears lb_display ready

        }
        private void btn_Minus_Click(object sender, EventArgs e)
        {



            func= 2;
            lb_Memory.Text = lb_Display.Text;  // sends text lb_Display to lb_Memory
            lb_Display.Text = " ";  //clears lb_display ready

        }

        //if( lb_Memory.Text == " ")








        private void btn_Multiply_Click(object sender, EventArgs e)
        {


            func = 3;
            lb_Memory.Text = lb_Display.Text;  // sends text lb_Display to lb_Memory
            lb_Display.Text = " ";  //clears lb_display ready

        }

        private void btn_Divide_Click(object sender, EventArgs e)
        {

            func = 4;
            lb_Memory.Text = lb_Display.Text;  // sends text lb_Display to lb_Memory
            lb_Display.Text = " ";  //clears lb_display ready



        }

        private void btn_Equals_Click(object sender, EventArgs e)
        {
            a = float.Parse(lb_Display.Text);
            b = float.Parse(lb_Memory.Text);

          //  calc maths = new calc();
            lb_Display.Text =Calculator (b, a, func).ToString(); // displays maths argument in lb_display
            SpVoice voice = new SpVoice();    // calls up a new instance of SpVoice 
            voice.Speak(lb_Display.Text, SpeechVoiceSpeakFlags.SVSFDefault);   // Speak everything in the label lb_Display using 
           /* try
            {


            }
            catch
            {
            }*/


        }

        private void btn_MemoryPlus_Click(object sender, EventArgs e)
        {

        }
    }
}

then DLL

using System;
using System.Collections.Generic;
using System.Text;

namespace neilsuperDLL
{
    public class calc
    {
       public float Calculate(float a, float b, int func)
        {
           float f; 
        switch(func) 
        {


        case 1:
        f = a + b;
        break;

        case 2:
        f = a - b;
        break;

        case 3:
        f = a * b;
        break;

        case 4:
        f = a / b;
        break;

        default:
        f =0.0F;
        break;
    }
    return f;

        }


    }
}

it would be easy for me if you attached your sloution directory in a zip file.
Thank you.

I didn't find this error when I compiled it.
I optimized it a bit, and set the voice default (which you did not.. which might have something to do with it.

Anyway, I have attached my version of your project for your review.

Jerry

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.