Making a shop with forms?

Started by
4 comments, last by Kheyas 11 years, 7 months ago
Hello! I'm requiring assistance for the following problem:
I am trying to make a simple shop using .net forms. You have 2 listboxes and you can transfer items from the first listbox, which is the shop to the second one which is the inventory. It works okay... but i want to make it a little bit more complicated. I want to have multiple columns. For name, price, quantity. I found out that a listview could do the job, but i can't handle it. Is there other way to make columned listboxes? Otherwise, can someone explain to me how I could use the listview to do the job instead?
Advertisement
http://stackoverflow...s-2-3-and-4-etc

Your best bet is probably the list view or datagrid objects. Datagrid might require even more work.
What part of the listview can you not handle?
You could just fake the columns. Decide where you want a column divider to be, and then when writing items into the listbox place a symbol, followed by a space and then item.Price. it wouldn't be hard to write in a non-selectable heading item for column titles to always be displayed at the top of the box.

-------R.I.P.-------

Selective Quote

~Too Late - Too Soon~

Use ListViews.

1. Put the listview in View = Details mode.
2. Add two columns.
3a. When you want to add items, you create ListViewItem objects and then add them with ListView.Items.Add.
3b. ListViewItem has a member "SubItems" which is an array containing the text to put in each column.
3c. ListViewItem has a member "Tag" which lets you keep a reference to any arbitrary object with the ListViewItem.
4. If you want to clear the listview, use ListView.Items.Clear, NOT ListView.Clear, since that will clear the columns as well!

They're extremely easy to use.
Nypyren made it clear. Anyone that knows a little bit about listviews will understand. Though I don't know... Would it work with an inventory too? Instead of adding the same item again changing a proprety of an item that is already there. That meaning instead of adding 2 arrows (on 2 rows), just using one row and increasing the quantity property by 1.

This topic is closed to new replies.

Advertisement