You need to associate a method with the button's "on click" event.

The code in the method will need to generate the textbox.

(Did you mean a message box?)

If you want more detailed help you're going to need to tell us more about your code environment, and preferably show us some code to show that you're trying to solve the problem.

You need to associate a method with the button's "on click" event.

The code in the method will need to generate the textbox.

If you want more detailed help you're going to need to tell us more about your code environment, and preferably show us some code to show that you're trying to solve the problem.

Well you just drag a button and a textbox on a form.
than go through the property window and make the visible property of texbox is false.

and than on click event of button just write this code:

textbox1.Visible=true;

Hope this works.......:)

Here is one example of creating a control in code:

using System;
using System.Drawing;
using System.Windows.Forms;

namespace daniweb
{
  public partial class frmCreateTB : Form
  {
    public frmCreateTB()
    {
      InitializeComponent();
    }

    private void button1_Click(object sender, EventArgs e)
    {
      TextBox tb = new TextBox();
      tb.Location = new Point(0, 0); //This is the top-left corner of the form
      tb.Text = "Auto created textbox!!!!!";
      using (Graphics g = this.CreateGraphics())
      {
        tb.Width = Convert.ToInt32(Math.Ceiling(g.MeasureString(tb.Text, tb.Font).Width));
      }
      this.Controls.Add(tb);
    }
  }
}
This question has already been answered. Start a new discussion instead.