TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Mr Celetron
NA
10
3.2k
How to pass value to unspecified object using delegate C#
Jun 30 2012 2:22 AM
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!
Reply
Answers (
2
)
Can We Specify the Access Modifiers for the Get and Set Accessors in a Property
windows form