Option Strict On 'VisualBasic2008 '入門用、タイピングGame Public Class Form1 Private Const Moji_Suu As Integer = 10 Private mondai(Moji_Suu - 1) As String Private Rnd As System.Random Private Level As Integer = 20 '________________レベル Private Tokuten As Integer = 0 Private Rn_d As Integer Private kaihi(Moji_Suu - 1) As Integer '重複回避 Private kaihi2 As Integer = 0 '乱数重複回避 Private Tukaisute As Integer Public Sub New() ' この呼び出しは、Windows フォーム デザイナで必要です。 InitializeComponent() ' InitializeComponent() 呼び出しの後で初期化を追加します。 '文字 mondai(0) = "りんご" mondai(1) = "パイナップル" mondai(2) = "いちご" mondai(3) = "レモン" mondai(4) = "みかん" mondai(5) = "きゅうり" mondai(6) = "BANANA" mondai(7) = "大福もち" mondai(8) = "なすび" mondai(9) = "ぶどう" Rnd = New System.Random() End Sub Private Sub Rnd_mize() Try 100: Rn_d = Rnd.Next(Moji_Suu) 200: For Me.Tukaisute = 0 To 9 If kaihi(Tukaisute) = Rn_d Then GoTo 100 Next kaihi(Tokuten) = Rn_d Label2.Text = mondai(Rn_d).ToString Catch Rn_d = kaihi2 kaihi2 += 1 : GoTo 200 End Try End Sub Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load For Me.Tukaisute = 0 To 9 kaihi(Tukaisute) = 100 Next hyouji() Rnd_mize() With Me.Timer1 .Interval = Level * 50 '_____数字注意_____!!! .Start() End With End Sub Private Sub Ending() Me.Label1.Text = "Closeして下さい" Me.Label2.Text = "終了" Me.Label3.Text = "得点" & "" & Tokuten & "点" Me.TextBox1.Enabled = False Me.Timer1.Stop() End Sub Private Sub hyouji() Me.Label1.Text = "残り" & Level & "秒" Me.Label3.Text = Tokuten + 1 & "問" End Sub Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick Try hyouji() Level -= 1 If Level = 0 Then Level = 20 Ending() End If If TextBox1.Text = mondai(Rn_d) Then TextBox1.Text = Nothing Tokuten += 1 : Level = 20 : hyouji() If Tokuten = 10 Then Ending() Else Level = 20 Rnd_mize() End If End If Catch MsgBox("コードError") End Try End Sub End Class ' 'Form1 '____________________________________________ ' | ' Label 1 | ' | ' Label 2 | ' | ' Label 3 | ' | ' | ' TextBox1 | ' | ' | 'コンポーネント __ Timer1 | ' | '____________________________________________|