Thank you for helping me!
In Microsoft Expression Blend 4 (WPF), I wrote a piece of code below, to control the range of x. The code can be down again and again when I press keys:
if (e.KeyStates == Keyboard.GetKeyStates(Key.Down))
{
x = x + 0.2;
if (x == 0.8)
{
x = x - 0.2;
}
TB.Text= Convert.ToString(-x*5);
}
else if (e.KeyStates == Keyboard.GetKeyStates(Key.Up))
{
x = x - 0.2;
if (x == -1)
{
x = x + 0.2;
}
TB.Text= Convert.ToString(-x*5);
}
However, when I press up and down randomly, I found thet in the TB(a textbox), the 0 doesn't appear, and is replaced by 2.775 or -2.77. How come?
Thank you!