VB程序制作一个成绩等级程序,要求在文本框Text1中输入成绩,点击 等级按钮时,文本框里就显示相应等级。
VB程序制作一个成绩等级程序,要求在文本框Text1中输入成绩,点击等级按钮时,文本框里就显示相应等级。具体等级划分如下:90分以上为优,80到89为好,70到79为良,...
VB程序制作一个成绩等级程序,要求在文本框Text1中输入成绩,点击 等级按钮时,文本框里就显示相应等级。具体等级划分如下:90分以上为优,80到89为好,70到79为良,60到69为及格,60分以下为不及格
展开
1个回答
推荐于2017-12-16
展开全部
Private Sub Command1_Click()
If Text1.Text = "" Then
MsgBox "请输入成绩", vbInformation, "提示"
Text1.SetFocus
Exit Sub
End If
If IsNumeric(Text1.Text) = False Then
MsgBox "你输入的不是数字,请重新输入", vbInformation, "提示"
Text1.SetFocus
SendKeys "{Home}+{End}"
Exit Sub
Else
End If
Select Case Trim(Text1.Text)
Case Is >= 90: Text1.Text = Text1.Text & "分为:优"
Case 80 To 89: Text1.Text = Text1.Text & "分为:好"
Case 70 To 79: Text1.Text = Text1.Text & "分为:良"
Case 60 To 69: Text1.Text = Text1.Text & "分为:及格"
Case Is <= 60: Text1.Text = Text1.Text & "分为:不及格"
End Select
End Sub
If Text1.Text = "" Then
MsgBox "请输入成绩", vbInformation, "提示"
Text1.SetFocus
Exit Sub
End If
If IsNumeric(Text1.Text) = False Then
MsgBox "你输入的不是数字,请重新输入", vbInformation, "提示"
Text1.SetFocus
SendKeys "{Home}+{End}"
Exit Sub
Else
End If
Select Case Trim(Text1.Text)
Case Is >= 90: Text1.Text = Text1.Text & "分为:优"
Case 80 To 89: Text1.Text = Text1.Text & "分为:好"
Case 70 To 79: Text1.Text = Text1.Text & "分为:良"
Case 60 To 69: Text1.Text = Text1.Text & "分为:及格"
Case Is <= 60: Text1.Text = Text1.Text & "分为:不及格"
End Select
End Sub
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询