0

Possible Duplicate:
Calling A Button OnClick from a function

I want to do button click event automatically .I want code for button click event without manual clicking of the button.

Community
  • 1
  • 1
user1737072
  • 80
  • 2
  • 8
  • 2
    Do u mean some thing like UIautomation or calling the event??? – DevT Oct 12 '12 at 03:26
  • This sounds like a design problem rather than a serious requirement. Why do you want to do this? – Enigmativity Oct 12 '12 at 03:58
  • I want to win the lottery. Oh wait - I forgot to mention what I tried - I went to the store, bought 20 tickets, used random numbers - but still didn't win anything. What could I try next? Can you see the correlation between this and your question? Please tell us what you have tried so we can try to help you.... – tsells Oct 12 '12 at 04:09
  • 1
    WinForms, ASP.NET, GTK#, WPF...? – Theraot Oct 12 '12 at 04:37

2 Answers2

0

I think you're looking for Button.PerformClick();

button1.PerformClick();
itsme86
  • 19,266
  • 4
  • 41
  • 57
0

I have two things to say:

  • You should modify your applications to use IObservables for the events in such a way that you can mock the events allowing for better testing.
  • If you want to automate UI interaction, There is a DLL for that thanks to DataDink
Community
  • 1
  • 1
Theraot
  • 31,890
  • 5
  • 57
  • 86