Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I create a C# Array of Buttons?

How do I build an array of buttons in a Winforms application?

What I am trying to do is this: I have a lot of buttons in a sort of calendar arrangement, that are indicating time slots. IE: Monday0700Button, Monday0730Button, Monday0800Button, and so on in 30min intervals.

I have a xml database, where one of the fields for appointments is <Duration> When the duration = 0.5hrs, and the <Time> field equals "07:00am", to color the 'Monday0700Button'. When the Duration is 1.0hrs, I want it to populate 'Monday0700Button' as well as the following time slot button of 'Monday0730Button'.

Any ideas? Thanks.

like image 998
The Woo Avatar asked Nov 05 '09 03:11

The Woo


People also ask

How can I write C in Windows?

Two options. Great, now that Visual Studio Community is installed, you have two options for developing and running C programs on Windows. The first option involves using any text editor you like to write your source code, and using the "cl" command within the Developer Command Prompt to compile your code.


1 Answers

Yes, you can build a list of buttons like below.

List<Button> listOfButtons = new List<Button>();
listOfButtons.Add(yourButton);
like image 70
Taylor Leese Avatar answered Sep 19 '22 20:09

Taylor Leese