Jump to content

  • Log In with Google      Sign In   
  • Create Account


Making a shop with forms?


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
5 replies to this topic

#1 Kheyas   Members   -  Reputation: 179

Like
0Likes
Like

Posted 03 September 2012 - 07:18 AM

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?

Edited by Kheyas, 03 September 2012 - 07:19 AM.


Sponsor:

#2 6677   Members   -  Reputation: 1058

Like
1Likes
Like

Posted 03 September 2012 - 08:03 AM

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.

Edited by 6677, 03 September 2012 - 08:04 AM.


#3 ShadowValence   Members   -  Reputation: 369

Like
0Likes
Like

Posted 03 September 2012 - 09:04 AM

What part of the listview can you not handle?

#4 Khaiy   Crossbones+   -  Reputation: 1342

Like
0Likes
Like

Posted 03 September 2012 - 11:17 AM

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.

#5 Nypyren   Crossbones+   -  Reputation: 3646

Like
3Likes
Like

Posted 03 September 2012 - 01:12 PM

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.

#6 Kheyas   Members   -  Reputation: 179

Like
0Likes
Like

Posted 03 September 2012 - 02:44 PM

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.




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS