i am making a program need 128 button
when u click on button color of button change to red
when you click it a gain it back to normal color
is there a way to code one button and the other take the same function
thank at all
Fire_Michel
0
Newbie Poster
Recommended Answers
Jump to PostButton[] btnsAry = (Button[])FindControlsOfType(/*this*/ form1, typeof(Button)); foreach (Button btn in btnsAry) btn.BackColor = Color.Red;
Or, you could use a list (List<>):
List<Control> btnList = ListControlsOfType(/*this*/ form1, typeof(Button)); foreach (Button btn in btnList) btn.BackColor = Color.Red;
Jump to Postthanks very much
the compiler give me a message
The name 'FindControlsOfType' does not exist in the current contextSorry about that. I just realized that I had copied those methods from somewhere into a code file I have. I searched the forum to see if I found them here, …
All 7 Replies
DdoubleD
315
Posting Shark
Fire_Michel
0
Newbie Poster
DdoubleD
315
Posting Shark
kvprajapati
1,826
Posting Genius
Team Colleague
DdoubleD
315
Posting Shark
Fire_Michel
0
Newbie Poster
Fire_Michel
0
Newbie Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.