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
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
there is a good example here on using listbox http://www.c-sharpcorner.com/UploadFile/devinderarora/ListBoxDA00111182005034107AM/ListBoxDA001.aspx
how are you wanting to populate the listbox
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(butt on1.Text + itemprice[1]);
but when i delete the line
TillDisplay.Items.Remove(T illDisplay .SelectedI tem);
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!?
TillDisplay.Items.Add(butt
but when i delete the line
TillDisplay.Items.Remove(T
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
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Ive been looking here which contains samples for various things http://msdn.microsoft.com/en-us/library/6dwb14tw.aspx
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
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());
float a = 20
....add ( a.ToString());
ASKER
Great Help! Thanks!