First remove this
private void textBox1_TextChanged(object sender, EventArgs e)
{
string s;
s = textBox1(textBox1.Text);
}
as you don't need this for what you are trying to do and will give compilation errors as well,then
Try this :
private void button1_Click(object sender, EventArgs e)
{
string s=textbox1.text;
switch(s)
{
case "1":
{
Form2 f = new Form2();
f.Show();
}
break;
case "2":
{
Form3 f3 = new Form3();
f3.Show();
}
break;
default:
MessageBox.Show("Please enter 1 or 2");
break;
}
}
But I would suggest you to go for
combobox
as suggested by John rather than using textbox to remove the overhead on user for giving the right text in textbox.
hope it helps :)