how would i go about putting each number button 0-9 into one piece of code and then call it in the click_event

You can just manually change the handler for the buttons to the same method.

I've never done this myself but i would assume you need to create your own custom event handler and event. have a look at this

Something like this works ...

private void Form1_Load(object sender, EventArgs e)
        {
            btn0.Click += new EventHandler(ButtonClickHandler);
            btn1.Click += new EventHandler(ButtonClickHandler);
            // etc.
        }

        private void ButtonClickHandler(object sender, EventArgs e)
        {
            Button btn = (Button)sender;
            if (btn == btn0)
            { 
                // Handle btn0 ...
                // etc.
            }
        }

I would do what viljoed does, but I would put my buttons in an array or a list for easy handling.

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.