954,500 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

How to select button

I have a form of c sharp, In winch I have Five Button.I want hit all buttons one by one dynamically.
Please send me complete Code of c sharp.

yousafc#
Junior Poster in Training
82 posts since Feb 2011
Reputation Points: 10
Solved Threads: 1
 

To programmatically press a button in C#, use the PerformClick() method on each button.

b1.PerformClick()
b2.PerformClick()
b3.PerformClick()
b4.PerformClick()
b5.PerformClick()
LaMouche
Posting Whiz in Training
269 posts since Oct 2006
Reputation Points: 83
Solved Threads: 39
 

How I perform with iteration
As a Loop

yousafc#
Junior Poster in Training
82 posts since Feb 2011
Reputation Points: 10
Solved Threads: 1
 

How does this look.

var buttons = new[] { button1, button2, button3, button4, button5 };
Array.ForEach(buttons, b => b.PerformClick());
nick.crane
Nearly a Posting Virtuoso
1,230 posts since Feb 2010
Reputation Points: 375
Solved Threads: 187
 

What you you select all (one by one, but all eventually)? Isnt this a bid odd?

Or did you mean something else?

Mitja Bonca
Nearly a Posting Maven
2,485 posts since May 2009
Reputation Points: 641
Solved Threads: 474
 

thanks nick.crane ,You solved the problem .


and Thanks for Lamouche and Mitja Bonca

yousafc#
Junior Poster in Training
82 posts since Feb 2011
Reputation Points: 10
Solved Threads: 1
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You
View similar articles that have also been tagged: