aspkiddy

aspkiddy

  • NA
  • 17
  • 0

convert number (for example 22.00) to 2000 with no decimal

Feb 1 2011 1:02 PM
Amount text box...
the number is positive and this field should be sent as cents ( $22.00 should be sent as 2200 with no decimal).

How can I ?

in my first form page (where there is a textbox/ field )

I use
 private void SetPageState()

        {

         int amountInt = int.Parse(mamountTextBox.Text);

         mFormPageState.AmountContribution = amountInt.ToString("0.00");



        SavePageState();

        }





        public struct FormPageState

        {



        public int amountInt;



        public string AmountContribution;

        }




The user enter, for example, 22

and the second screen, I can display as I want:

22.00 with the following code


 mAmountLabel.Text = s.AmountContribution;




So I must transform this number (for example 22.00) to 2000 with no decimal for sending on the transaction server


How can I ? could you help me please

Answers (15)