Tuesday, July 14, 2009

How do I use int.Parse on C#?

I'm using Visual Web Developer 2008.





I'm making a transaction page where the user inputs the quantity of items he wants to buy. When he clicks the "Buy" button, the quantity of that certain item is decreased by the quantity of items he bought.





Do I use int.Parse on that? If so, how should the code look like?

How do I use int.Parse on C#?
Something like this:





int numPurchased = int.Parse(textbox.Text);





Then subtract numPurchased from the total item quantity.


No comments:

Post a Comment