Public Class Form1 Dim myA, myB, myC, myD, myE, myF As Integer
Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click If TextBox1.Text < 101 Then If TextBox1.Text <= 100 And TextBox1.Text >= 90 Then myA += 1 Label1.Text = "A 등급입니다" Label2.Text = "A 등급 누적" & myA End If If TextBox1.Text <= 89 And TextBox1.Text >= 80 Then myB += 1 Label1.Text = "B 등급입니다" Label3.Text = "B 등급 누적" & myB End If If TextBox1.Text <= 79 And TextBox1.Text >= 70 Then myC += 1 Label1.Text = "C등급입니다" Label4.Text = "C 등급 누적" & myC End If If TextBox1.Text <= 69 And TextBox1.Text >= 60 Then myD += 1 Label1.Text = "D 등급입니다" Label5.Text = "D 등급 누적" & myD End If If TextBox1.Text <= 59 And TextBox1.Text >= 50 Then myE += 1 Label1.Text = "E 등급입니다" Label6.Text = "E 등급 누적" & myE End If If TextBox1.Text <= 49 Then myF += 1 Label1.Text = "F 등급입니다" Label7.Text = "F 등급 누적" & myF End If Else Label1.Text = " 100점 보다 작아야 합니다" End If
TextBox1.Text = "" End Sub
Private Sub TextBox1_KeyPress(sender As System.Object, e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox1.KeyPress If Not (Char.IsDigit(e.KeyChar) OrElse e.KeyChar = Convert.ToChar(Keys.Back)) Then e.Handled = True End If End Sub End Class
Public Class Form1 Dim a, b, c, d, e1, f As Integer
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click If IsNumeric(TextBox1.Text) = False Then MsgBox("숫자를 입력하세요") TextBox1.Text = "" Return End If
If CInt(TextBox1.Text) > 101 Or CInt(TextBox1.Text) < -1 Then MsgBox("올바른 값을 입력하세요") TextBox1.Text = "" Return End If
If CInt(TextBox1.Text) > 89 Then Label2.Text = "A 등급" : a += 1 : Label3.Text = "A 등급 : " & a
ElseIf CInt(TextBox1.Text) > 79 Then Label2.Text = "B 등급" : b += 1 : Label4.Text = "B 등급 : " & b
ElseIf CInt(TextBox1.Text) > 69 Then Label2.Text = "C 등급" : c += 1 : Label5.Text = "C 등급 : " & c
ElseIf CInt(TextBox1.Text) > 59 Then Label2.Text = "D 등급" : d += 1 : Label6.Text = "D 등급 : " & d
ElseIf CInt(TextBox1.Text) < 49 Then Label2.Text = "F 등급" : f += 1 : Label8.Text = "F 등급 : " & f End If End Sub
Private Sub TextBox1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox1.Click TextBox1.Text = "" : Label2.Text = "" End Sub End Class
Public Class Form1
Dim myA, myB, myC, myD, myE, myF As Integer
Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
If TextBox1.Text < 101 Then
If TextBox1.Text <= 100 And TextBox1.Text >= 90 Then
myA += 1
Label1.Text = "A 등급입니다"
Label2.Text = "A 등급 누적" & myA
End If
If TextBox1.Text <= 89 And TextBox1.Text >= 80 Then
myB += 1
Label1.Text = "B 등급입니다"
Label3.Text = "B 등급 누적" & myB
End If
If TextBox1.Text <= 79 And TextBox1.Text >= 70 Then
myC += 1
Label1.Text = "C등급입니다"
Label4.Text = "C 등급 누적" & myC
End If
If TextBox1.Text <= 69 And TextBox1.Text >= 60 Then
myD += 1
Label1.Text = "D 등급입니다"
Label5.Text = "D 등급 누적" & myD
End If
If TextBox1.Text <= 59 And TextBox1.Text >= 50 Then
myE += 1
Label1.Text = "E 등급입니다"
Label6.Text = "E 등급 누적" & myE
End If
If TextBox1.Text <= 49 Then
myF += 1
Label1.Text = "F 등급입니다"
Label7.Text = "F 등급 누적" & myF
End If
Else
Label1.Text = " 100점 보다 작아야 합니다"
End If
TextBox1.Text = ""
End Sub
Private Sub TextBox1_KeyPress(sender As System.Object, e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox1.KeyPress
If Not (Char.IsDigit(e.KeyChar) OrElse e.KeyChar = Convert.ToChar(Keys.Back)) Then
e.Handled = True
End If
End Sub
End Class
이 댓글을
Public Class Form1
Dim a, b, c, d, e1, f As Integer
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
If IsNumeric(TextBox1.Text) = False Then
MsgBox("숫자를 입력하세요")
TextBox1.Text = ""
Return
End If
If CInt(TextBox1.Text) > 101 Or CInt(TextBox1.Text) < -1 Then
MsgBox("올바른 값을 입력하세요")
TextBox1.Text = ""
Return
End If
If CInt(TextBox1.Text) > 89 Then
Label2.Text = "A 등급" : a += 1 : Label3.Text = "A 등급 : " & a
ElseIf CInt(TextBox1.Text) > 79 Then
Label2.Text = "B 등급" : b += 1 : Label4.Text = "B 등급 : " & b
ElseIf CInt(TextBox1.Text) > 69 Then
Label2.Text = "C 등급" : c += 1 : Label5.Text = "C 등급 : " & c
ElseIf CInt(TextBox1.Text) > 59 Then
Label2.Text = "D 등급" : d += 1 : Label6.Text = "D 등급 : " & d
ElseIf CInt(TextBox1.Text) > 49 Then
Label2.Text = "E 등급" : e1 += 1 : Label7.Text = "E 등급 : " & e1
ElseIf CInt(TextBox1.Text) < 49 Then
Label2.Text = "F 등급" : f += 1 : Label8.Text = "F 등급 : " & f
End If
End Sub
Private Sub TextBox1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox1.Click
TextBox1.Text = "" : Label2.Text = ""
End Sub
End Class
이 댓글을