以下有一道VB题目,请指教!

2024-12-01 10:57:42
推荐回答(4个)
回答1:

你要的程序代码来了,我已经验证OK!!!

Private Sub Command1_Click()
Dim str As String
str = Text1.Text
Select Case Val(Left(Text1.Text, 2))
Case 1
Text2.Text = "一年级"
Case 2
Text2.Text = "二年级"
Case 3
Text2.Text = "三年级"
Case Else
Text2.Text = "四年级"
End Select
Select Case Val(Mid(Text1.Text, 5, 1))
Case 2
Text3.Text = "博士生"
Case 3
Text3.Text = "硕士生"
Case 4
Text3.Text = "本科生"
Case Else
Text3.Text = "专科生"
End If
End Sub

不要定义太多的变量,占内存啊!我也是VB爱好者,以后要多互相学习了!!!

回答2:

y = Val(Text1.Text)
y = abcdefghi
改为:

b = Val((MidText1.Text, 1, 2)))
e = Val((MidText1.Text, 5, 1)))

回答3:


y = Val(Text1.Text)
y = abcdefghi
改为
b = Val(Mid(Text1.Text, 1, 2))
e = Val(Mid(Text1.Text, 5, 1))

回答4:

VB垃圾