Reputation: 1075
What would be the best way to display items in c# in a form
For example I have a pizza(small,medium,large) button.
If I press the small pizza button it will display like this:
Order:
Item Quantity Price
Small Pizza 1 3.99
If I press the add pepperoni button it will display like this:
Order:
Item Quantity Price
Small Pizza 1 3.99
-Pepperoni 1 0.99
If I press the add pepperoni button it will display like this(making it double pep):
Order:
Item Quantity Price
Small Pizza 1 3.99
-Pepperoni 2 1.98
Also adding another item such as a large pizza it will display like this:
Order:
Item Quantity Price
Small Pizza 1 3.99
-Pepperoni 2 1.98
Large Pizza 1 6.99
I basically just want it so you can see what you've added to the order.
What would be the best way to do this with c# and windows form?
Upvotes: 0
Views: 5686
Reputation: 400
For a general look at some of the tools available for developing c# applications focused on winforms I'd point you to the MSDN How Tos:
http://msdn.microsoft.com/en-us/vstudio/bb798022#winforms
There are some specific for list controls which others have mentioned, and several provide examples of how to hook up button press events to performing user interface actions.
I would also advise the use of databinding in place of "manually" setting/retrieving values.
Upvotes: 2
Reputation: 390
There is no simple answer since the question is not well formed in my opinion.
If you are asking for specific GUI control, I will answer:
ListView, XPTable, ObjectListView, etc... it depends on specific requirements.
If you are asking more for best application design, the answer would be to implement MVP design pattern, or just to use data binding. It is really hard to suggest anything more specific, since question doesn't describe any specific use case.
Edit: So for lists the XPTable control (http://www.codeproject.com/KB/list/XPTable.aspx - and updated version on sourceforge) should be OK. ObjectListView gives also advanced options, but as far as I know is not free. I don't recommend to use native .NET controls, since they aren't really customizable.
Upvotes: 0
Reputation: 3213
you can use list box with multi-columns this link will help you http://www.codeproject.com/KB/combobox/multicolumnlistbox.aspx
Upvotes: 1