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
kris sarma
NA
5
5.4k
PerformClick not working for second time
Sep 28 2012 1:41 AM
I have a dialog with a button.
Somewhere in another page, I am launching the dialog and registering Load event and firing the button click using button.PerformClick
This works fine when I create instance of dialog every time where i am planning to call. but if I reuse the dialog, second time onwards the button click event is not firing
public partial class dlg : Form
{ // button1 is public
public dlg() { InitializeComponent(); }
private void button1_Click(object sender, EventArgs e) { MessageBox.Show("XXX"); }
}
-------------
dlg d = new dlg(); // option 1
void Test()
{
// dlg d = new dlg(); // option 2
d.Load += new EventHandler(delegate(object a, EventArgs ty) { d.button1.PerformClick(); });
d.ShowDialog();
}
If I enable option 2, I would get message "XXX" each time i call the Test method. If I enable option 1, first time it popups the message and not for the consequent times.
Reply
Answers (
4
)
How to validation for combox in windows applications
get names of scanning devices in listbox which is connected to system??