Tag: ui-design

5: voting program


For counting votes (admin only), this simple program (written in 45 minutes) shows a set of buttons for each candidate and you can click on the button to increase his votes.

Candidates.txt is the input and also where the count is stored.
Once counting is over (or anytime), simply open the Count tab to see the results.

Count has 3 buttons. Clear to reset all counts to 0, Names to open the text file for editing, Reload when changes are made manually.

See code overleaf or browse or download.


  • Create a Candidate Control which has a button to show his name and a label to display the number of votes. have it implement ICandidate for SoC
  • ICandidate has PersonName, Votes (int) and a Clear() method.
  • VoteForm loads from file and puts controls in a flow panel.
  • Candidate Control broadcasts a static event whenever a vote is made. this is listened in the Form and the text file is saved each time.

Read more »

1: items by category

This is a simple crossmatrix of items by category or categories by item.
Its developed as a simple standalone asp.net page with a backing static class (with xml serialization for persistence) 3 simple structs for item, category and ItemInCategory.

There are 5 tabs which show one after the other (on the same page)
Cats: Manage List of Categories / Add
Items: Manage List of Items / Add
Matrix: Lets you add items to categories.
Cat Viewer: Shows list of categories, letting you see the items belonging to them.
Item Viewer: Shows list of Items, and the categories in which they belong. Read more »