Visual Basic 中学校 掲示板 投稿の管理
タグのない投稿を抽出
統計
RSS
Visual Basic 中学校
投稿一覧
visualbasic6.0を2008で
この投稿へのリンク
https://keijiban.umayadia.com/ThreadDetail.aspx?ThreadId=9645#CommentId14765
この投稿の削除
削除パスワード
削除する
コメント本文
投稿者
colo
 (高校生)
投稿日時
2010/5/24 01:10:31
全部乗せます
Public Class Form1
Dim Answer(100) As String
Dim Question(100) As String
Dim Qcount As Integer
Private Sub SetProblem()
QCount = QCount + 1
Label1.Text = Question(Qcount)
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
LoadProblem() '問題を読み込む
SetProblem() '最初の問題を出題する
Label2.Text = "答えを入力してください"
Label3.Text = "問題"
End Sub
Private Sub TextBox1_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles TextBox1.KeyDown
If e.KeyCode = Keys.Enter Then
Button1.PerformClick()
End If
End Sub
Private Sub TextBox1_KeyDown1(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles TextBox1.KeyDown
If e.KeyCode = Keys.Back Then
Using g As Graphics = Me.CreateGraphics
g.Clear(Color.Aqua)
End Using
End If
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
If TextBox1.Text = Answer(Qcount) Then
Dim p As New Pen(Color.Red)
p.Width = 10
Using g As Graphics = Me.CreateGraphics
g.DrawEllipse(p, 70, 20, 230, 230)
End Using
Else
Dim p1 As New Pen(Color.Blue)
p1.Width = 10
Using g As Graphics = Me.CreateGraphics
g.DrawLine(p1, 0, 0, 389, 280)
g.DrawLine(p1, 0, 260, 370, 0)
End Using
End If
TextBox1.Text = " "
SetProblem() 'ここで次の問題を呼び出している。
End Sub
Private Sub LoadProblem()
Dim K As Short
FileOpen(1, My.Application.Info.DirectoryPath & "\test.eng", OpenMode.Input)
Do Until (EOF(1))
K = K + 1
Input(1, Question(K))
Input(1, Answer(K))
Loop
FileClose(1)
End Sub
End Class
でtest.engが
"入る"
"enter"
"を教育する"
"educate"
"勝つ"
"win"
となってます