We help IT Professionals succeed at work.

C# Listbox help

grazhull
grazhull asked
on
269 Views
Last Modified: 2012-08-14
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
Comment
Watch Question

CERTIFIED EXPERT
Top Expert 2006

Commented:
CERTIFIED EXPERT
Top Expert 2006

Commented:
how are you wanting to populate the listbox

Author

Commented:
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!?
CERTIFIED EXPERT
Top Expert 2006
Commented:
Unlock this solution and get a sample of our free trial.
(No credit card required)
UNLOCK SOLUTION
CERTIFIED EXPERT
Top Expert 2006

Commented:
Ive been looking here which contains samples for various things http://msdn.microsoft.com/en-us/library/6dwb14tw.aspx
CERTIFIED EXPERT
Top Expert 2006
Commented:
Unlock this solution and get a sample of our free trial.
(No credit card required)
UNLOCK SOLUTION
CERTIFIED EXPERT
Top Expert 2006
Commented:
Unlock this solution and get a sample of our free trial.
(No credit card required)
UNLOCK SOLUTION

Author

Commented:
with subitems.add it requires a string, is there anyway it can be made to use say a float?
CERTIFIED EXPERT
Top Expert 2006

Commented:
use tostring eg
float a = 20
....add (  a.ToString());

Author

Commented:
Great Help! Thanks!
Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a sample view!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.