I have a FlowLayoutPanel containing an unspecified number of Labels, when I double click in one of them, a new Form containing a TextBox and a Button will appear, here is the code:
foreach (Label lb in FlowLayoutPanel1.Controls)
{
lb.MouseDoubleClick+=new MouseEventHandler(lb_MouseDoubleClick);
}
private void lb_MouseDoubleClick(object sender, MouseEventArgs e)
{
NewForm form = new NewForm();
form.ShowDialog();
((Label)sender).Text = ...;//I want get text from TextBox of the NewForm here
}
I want get Text from TextBox of the NewForm and assign Text to the object that invoke the NewForm when user click the Button of the NewForm, I know to use properties or static variable to do this, but I dont know how to use delegate to do this? Please help me,Thanks!
VulpesPosted Jun 30, 2012, 8:06 AM
Roy SPosted Jun 30, 2012, 7:37 AM
public string TextFromTextbox
{
get
{
return txtText.Text;
}
}
EDIT: Found a much better way.