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
Swatto
NA
23
11k
Pass object to event handler
Jan 31 2015 6:22 PM
Hi all,
I am trying to pass my object (ThisHost) to the next event handler so I can use it but unsure how, I would appreciate some advice please:
private void btn_Click (object sender, EventArgs e)
{
ContextMenuStrip HostMenu = new ContextMenuStrip();
foreach (Host ThisHost in m_HostList)
{
if (((Button)sender).Name == ThisHost.Key.ToString())
{
if (ThisHost.Windows == 1)
{
HostMenu.Items.Add("RDP");
}
HostMenu.Click += new EventHandler(HostMenu_Click); // Want to pass 'ThisHost' to to next eventhandler
}
}
HostMenu.Show(Cursor.Position);
}
Reply
Answers (
2
)
How to Add Multiple Crystal Reports To CrystalReport Viewer
Replace the Textual values of Word table by Colored ovals C#