المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : How to pass value to unspecified object using delegate C#



C# Programming
06-30-2012, 04:41 AM
Hi guys, I have a FlowLayoutPanel containing unspecified number of Label ,when 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 Form when user click the Button of the Form, I don't know how to use delegate to do this, please help! Thanks for reading this!