If answer1 = guess1 Then
Label1.Text = "맞음"
ElseIf answer1 < guess1 Then
Label1.Text = guess1 & "보다 낮음"
ElseIf answer1 > guess1 Then
Label1.Text = guess1 & "보다 높음"
End If
End Sub
End Class
Public Class Form1 Dim n, n1, count As Integer Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load Label2.Text = "0" End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim rand As New Random
n = rand.Next(1, 101) Randomize() MsgBox("숫자를 생성 했습니다" & vbCrLf & "이제 숫자를 맞춰보세요!!")
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click count += 1 Label2.Text += 1 n1 = TextBox1.Text
Label1.Text = "시도횟수 : " & count & "번"
If n = n1 Then MsgBox("정답입니다!! " & vbCrLf & count & " 번 만에 맞추셨네요!!") TextBox2.Text += count & "번만에 맞춤" & vbCrLf TextBox1.Text = "" count = 0 Label2.Text = "0"
ElseIf n > n1 Then MsgBox(n1 & " 이(가) 정답보다 작습니다") ElseIf n < n1 Then MsgBox(n1 & " 이(가) 정답보다 큽니다") End If
End Sub
Private Sub TextBox1_MouseClick(sender As System.Object, e As System.Windows.Forms.MouseEventArgs) Handles TextBox1.MouseClick TextBox1.Text = "" End Sub
Public Class Form1 Dim myVal As Integer Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click If TextBox1.Text = myVal Then Label3.Text = " 정답입니다 " ElseIf TextBox1.Text < myVal Then Label3.Text = " 작은 값입니다 " ElseIf TextBox1.Text > myVal Then Label3.Text = " 큰 값입니다 " Else Label3.Text = " 정확한 값을 입력하세요 " End If Label2.Text += 1
End Sub
Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load Dim myRand As New Random myVal = myRand.Next(1, 99) Randomize() 'Label4.Text = myVal End Sub End Class
Public Class Form1
Dim n, n1, count As Integer
Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
Label2.Text = "0"
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim rand As New Random
n = rand.Next(1, 101)
Randomize()
MsgBox("숫자를 생성 했습니다" & vbCrLf & "이제 숫자를 맞춰보세요!!")
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
count += 1
Label2.Text += 1
n1 = TextBox1.Text
Label1.Text = "시도횟수 : " & count & "번"
If n = n1 Then
MsgBox("정답입니다!! " & vbCrLf & count & " 번 만에 맞추셨네요!!")
TextBox2.Text += count & "번만에 맞춤" & vbCrLf
TextBox1.Text = ""
count = 0
Label2.Text = "0"
ElseIf n > n1 Then
MsgBox(n1 & " 이(가) 정답보다 작습니다")
ElseIf n < n1 Then
MsgBox(n1 & " 이(가) 정답보다 큽니다")
End If
End Sub
Private Sub TextBox1_MouseClick(sender As System.Object, e As System.Windows.Forms.MouseEventArgs) Handles TextBox1.MouseClick
TextBox1.Text = ""
End Sub
End Class
이 댓글을
Public Class Form1
Dim myVal As Integer
Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
If TextBox1.Text = myVal Then
Label3.Text = " 정답입니다 "
ElseIf TextBox1.Text < myVal Then
Label3.Text = " 작은 값입니다 "
ElseIf TextBox1.Text > myVal Then
Label3.Text = " 큰 값입니다 "
Else
Label3.Text = " 정확한 값을 입력하세요 "
End If
Label2.Text += 1
End Sub
Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
Dim myRand As New Random
myVal = myRand.Next(1, 99)
Randomize()
'Label4.Text = myVal
End Sub
End Class
이 댓글을