我想知道在比较两个值时是否可以编写新的streamwrite输出文件。我的一个值在LabelBox
中,另一个在ListBox
中,并由输入文件填充。它的目的是假设只有当LabelBox值大于Listbox值时,这个新值才会改变。请参阅以下代码:
if (MaxRolls == 0)
{
Random getMax = new Random();
totalmoneyLabel.Text = "";
}
else if (RollCount >= MaxRolls)
{
//
if (runningTotal >= highscore)
{
StreamWriter outputFile;
outputFile = File.CreateText("HighScore.txt");
outputFile.WriteLine("New Highscore!!");
outputFile.WriteLine(totalmoneyLabel.Text);
outputFile.Close();
}
//
MaxRolls = 25;
RollCount = 0;
runningTotal = 0;
totalmoneyLabel.Text = "$0.00";
Show();
MessageBox.Show("You lost!");
return;
}