locked
Convert to float to int

    Question

  • Hi,

    How would I change the float amount in PercentOfChanege.text to a int? I want whole number. Here is the code I am using:

     double inputThreeValue = 0.0, inputFourValue = 0.0;
                if (true == Double.TryParse(PercentOfChangea.Text, out inputThreeValue) && true == Double.TryParse(FiftyTwoWlkHigh.Text, out inputFourValue))
                {
                    
                    PercentOfChange.Text = ((inputThreeValue / inputFourValue) * -100).ToString();   
    
                }

    Thanks,

    John


    John Lisenby developer of My PC Playbook

    Thursday, July 31, 2014 2:58 PM

Answers

  • Like this:


    Matt Small - Microsoft Escalation Engineer - Forum Moderator
    If my reply answers your question, please mark this post as answered.

    NOTE: If I ask for code, please provide something that I can drop directly into a project and run (including XAML), or an actual application project. I'm trying to help a lot of people, so I don't have time to figure out weird snippets with undefined objects and unknown namespaces.

    Thursday, July 31, 2014 6:09 PM
    Moderator

All replies

  • Like this:


    Matt Small - Microsoft Escalation Engineer - Forum Moderator
    If my reply answers your question, please mark this post as answered.

    NOTE: If I ask for code, please provide something that I can drop directly into a project and run (including XAML), or an actual application project. I'm trying to help a lot of people, so I don't have time to figure out weird snippets with undefined objects and unknown namespaces.

    Thursday, July 31, 2014 6:09 PM
    Moderator
  • Thanks!

    John


    John Lisenby developer of My PC Playbook

    Friday, August 01, 2014 4:05 PM