-2
私はクイズを作成しています。前にも述べたように、ハイスコア機能が必要です。私がプログラムを走らせると、最高得点が必ずしも最高得点ではないという点を除いて、すべてが問題ありません。クイズを作るビジュアルベーシックでは、正常に動作しないハイスコア機能が必要です。
私がそれをやり直すと、低いスコアが引き続き最高のスコアに置き換えられます。 2番目と3番目に高い数字が表示されません。
ここにコードがあります。最後の質問の終わり。)
Public score As Integer = 0
'best score
Dim highest As Integer
'second best
Dim scoreuno As Integer
'third best
Dim scoredos As Integer
Private Sub Form7_Load(sender As Object, e As EventArgs) Handles MyBase.Load
End Sub
Private Sub scoreupdate()
highScore.Text = highest.ToString
score2.Text = scoreuno.ToString
score3.Text = scoredos.ToString
End Sub
Public Sub highscores()
If score > highest Then
scoredos = scoreuno
scoreuno = highest
highest = score
ElseIf score > scoreuno Then
scoredos = scoreuno
scoreuno = score
ElseIf score > scoredos Then
scoredos = score
End If
scoreupdate()
End Sub
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
score = 0
Form1.Show()
Me.Close()
End Sub
を使用し、最後にあなたのスコアを割り当てるために、それはちょうどあなたが
で
を使用するたびに置き換える追加使用するには ' highScore'、 'score2'と' score3'はLabelsまたはTextboxesです - ar彼らは正しい順序で配置されていますか?私が何かを逃していない限り、あなたが提供したコードはうまくいくはずです。 –