Click here to Skip to main content
15,881,173 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi devs,
I want a code for button that once click by mouse and once clicked by code in button_click event that's mean once we clicked this and once clicked by self
that is impossible?
sorry for my english
Posted
Comments
Sunil Kumar Pandab 10-Sep-12 5:21am    
Please improve your question. I am not getting your problem.
AmitGajjar 10-Sep-12 5:26am    
Why you want to perform multiple times click event ? any reason ?

Hi ,
Check this
you can out flag to check how many times you want this occur
C#
private void button2_Click(object sender, EventArgs e)
{
    MessageBox.Show("Test");
    button2_Click(sender, e);
}


Best Regards
M.Mitwalli
 
Share this answer
 
Comments
[no name] 10-Sep-12 5:31am    
Your code has no end. it will execute infinity.
Mohamed Mitwalli 10-Sep-12 5:36am    
Yes i mention on the solution if he want to put Flag for this
Mohamed Mitwalli 10-Sep-12 6:54am    
bool Flag = true;
private void button2_Click(object sender, EventArgs e)
{

MessageBox.Show("Test");
if (Flag == true)
{
Flag = false;
button2_Click(sender, e);
}
}
amirmohamad 10-Sep-12 6:55am    
5+
Mohamed Mitwalli 10-Sep-12 6:56am    
Thanks Amir
it's possible,
if you are working in Windows application
then use below line to fire click event from code
C#
button1.PerformClick();

Happy coding!
:)
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900