Try using this code:
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 button
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
Button btn = new Button();
private void Form1_Load(object sender, EventArgs e)
{
btn.Name = "0";
btn.Text = "btn";
btn.Location = new Point(10, 10);
btn.Width = 200;
btn.Height = 100;
btn.Text = "Button";
btn.MouseClick += mouseclick;
Controls.Add(btn);
btn.BringtoFront();
}
private void mouseclick(object sender, MouseEventArgs e)
{
MessageBox.Show("Button Clicked");
}
}
}
if you don't see your button,add BringtoFront() code and check location.