I need a program that takes my btnChicken_Click event (when being clicked) and save it as a variable.
I know my programs trash but really need it.

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

namespace Fatfood
{
    public partial class Form1 : Form
    {
        string a = "1pc ChickenJoy";
        string b = "1 Burger";
        string c = "1 Fries";
        string d = "1pc BurgerStake";
        string z = "1 CokeFloat";
        string f = "1 Pie";
        string g = "1 MilkTea";
        string h = "1 Sundae";

        public Form1()
        {
            InitializeComponent();
        }

        private void btnChicken_Click(object sender, EventArgs e)
        {
            Items.Items.Add(a); 
        }

        private void btnRemoveChicken_Click(object sender, EventArgs e)
        {
            Items.Items.Remove(b);
        }

        private void btnBurger_Click(object sender, EventArgs e)
        {
            Items.Items.Add(b);
        }

        private void btnRemoveBurger_Click(object sender, EventArgs e)
        {
            Items.Items.Remove(b);
        }

        private void btnFries_Click(object sender, EventArgs e)
        {
            Items.Items.Add(c);
        }

        private void btnRemoveFries_Click(object sender, EventArgs e)
        {
            Items.Items.Remove(c);
        }

        private void pictureBox8_Click(object sender, EventArgs e)
        {

        }

        private void pictureBox2_Click(object sender, EventArgs e)
        {

        }

        private void btnSundae_Click(object sender, EventArgs e)
        {
            Items.Items.Add(h);
        }

        private void btnMilkTea_Click(object sender, EventArgs e)
        {
            Items.Items.Add(g);
        }

        private void btnPie_Click(object sender, EventArgs e)
        {
            Items.Items.Add(f);
        }

        private void btnFloat_Click(object sender, EventArgs e)
        {
            Items.Items.Add(z);
        }

        private void btnBurgerStake_Click(object sender, EventArgs e)
        {
           Items.Items.Add(d);
        }

        private void pictureBox5_Click(object sender, EventArgs e)
        {

        }

        private void pictureBox6_Click(object sender, EventArgs e)
        {

        }

        private void pictureBox7_Click(object sender, EventArgs e)
        {

        }

        private void pictureBox3_Click(object sender, EventArgs e)
        {

        }

        private void pictureBox4_Click(object sender, EventArgs e)
        {

        }

        private void pictureBox1_Click(object sender, EventArgs e)
        {

        }

        private void btnRemoveStake_Click(object sender, EventArgs e)
        {
            Items.Items.Remove(d);
        }

        private void btnRemoveFloat_Click(object sender, EventArgs e)
        {
            Items.Items.Remove(z);
        }

        private void btnRemovePie_Click(object sender, EventArgs e)
        {
            Items.Items.Remove(f);
        }

        private void btnRemoveTea_Click(object sender, EventArgs e)
        {
            Items.Items.Remove(g);
        }

        private void btnRemoveSundae_Click(object sender, EventArgs e)
        {
            Items.Items.Remove(h);
        }

        private void Items_SelectedIndexChanged(object sender, EventArgs e)
        {

        }

        private void btnTotal_Click(object sender, EventArgs e)
        {

        }

        private void Total_SelectedIndexChanged(object sender, EventArgs e)
        {

        }
        //________________________//

    }
}

I think you'll have to be a little clearer on your problem. Assuming the btnChicken_Click event handler has already been added as a handler for btnChicken click event, it already has been saved.

I think perhaps an explanation of what you're trying to accomplish, as opposed to what you think you need, would help.

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.