Yeah, I figured it out, thanks. But you forgot one thing:
this.Controls.Add(textbox1);
Ok, well now I have a whole lot sorted out there's one thing bugging me. Why won't this work:
Code:
using System;
using System.Windows.Forms;
using System.ComponentModel;
using System.Drawing;
class MainForm : Form
{
public TextBox tbox = new TextBox();
public MainForm()
{
TextBox tbox = new TextBox();
Button butt = new Button();
tbox.Location = new Point(10,10);
this.Controls.Add(tbox);
butt.Location=new Point(tbox.Left+tbox.Width+20,10);
butt.Size=new Size(150,24);
butt.Text="Ok";
butt.Click += new System.EventHandler(this.ButtClick);
this.Controls.Add(butt);
Text = "Cool Stuff";
}
protected void ButtClick(object sender, System.EventArgs e)
{
MessageBox.Show(tbox.Text,"You typed",MessageBoxButtons.OK);
}
public static void Main()
{
Application.Run(new MainForm());
}
}
Why doesn't it show up the text?
nevermind, I figured it out.