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!

Roy S194 reputationPosted Jun 30, 2012, 3:37 AM EDT
public string TextFromTextbox
{
get
{
return txtText.Text;
}
}
EDIT: Found a much better way.
VulpesRank #55 · 29.2K reputationPosted Jun 30, 2012, 4:06 AM EDT