我试图做一个平均每分钟死亡错误的速度。这是我的代码现在,但它抛出一个错误,说字符串输入格式是错误的。有什么建议?我使用C#作为WPF。平均速度wpf
//Score is the number of bugs hit
score.Text = (_killings * 1).ToString();
//Change it to integer
int x = Int32.Parse(score.Text);
int y = Int32.Parse(TBCountdown.Text); - this is where the error is showing
//Get the average speed by dividing number of bugs hit during the time
int average = (x/y);
//Displaying the average score by converting int to string
averagescore.Text = average.ToString();
欲了解更多信息,我使用调度计时器,这是我的计时器的代码。
TBCountdown.Text = string.Format("00:0{0}:0{1}", time/60, time % 60);
您如何期待将TBCountdown.Text转换为Integer,它看起来像格式化为时间。您希望将该价值的哪一部分转换为您的y数据点? –
只是分钟和秒。 – user3098072