Link to home
Start Free TrialLog in
Avatar of grazhull
grazhull

asked on

C# Listbox help

Hi,

Im creating a till system with c#, which im not amazingly familar with.  What i want to happen with a push of a button is the name and a $ value to be sent to the list box wth the total $ value to be added up in a seperate box, I would also like to be able to delete the line out of the list box and the value to be removed from the 'running total'

I cant seem to figure out how to use values with ListBox, or if there would be a better system to use for this.  Any help would be greatly appreciated.

Thanks
Avatar of rockiroads
rockiroads
Flag of United States of America image

how are you wanting to populate the listbox
Avatar of grazhull
grazhull

ASKER

Just line by line, like you would see on well a till :P so far ive just added to it with

 TillDisplay.Items.Add(button1.Text + itemprice[1]);

but when i delete the line            

 TillDisplay.Items.Remove(TillDisplay.SelectedItem);

my total wont get updated, because i add it up seperatly which is why im trying to work out how to assign a value to the line im adding then i can just add up the value of each line and if a line gets removed that value will be taken away!?
ASKER CERTIFIED SOLUTION
Avatar of rockiroads
rockiroads
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Ive been looking here which contains samples for various things http://msdn.microsoft.com/en-us/library/6dwb14tw.aspx
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
with subitems.add it requires a string, is there anyway it can be made to use say a float?
use tostring eg
float a = 20
....add (  a.ToString());
Great Help! Thanks!