basically I tried to make a spawned textbox work in another private void. Right now it’s just showing me “The name ‘userinput’ does not exist in current context”. Btw it’s inside a mousedown event.
private void mousedownevent(object sender, MouseEventArgs e)
{
TextBox userinput = new TextBox();
userinput.Location = new Point(224, 239);
userinput.Name = "placeholder";
}
private void search_Click(object sender, EventArgs e)
{
if (userinput.text == "placeholder")
{
MessageBox.Show("placeholdeer");
}
}
tried using
var search = this.controls[“placeholder”]
also tried making them public.
New contributor
Olrak Elamparo is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.