Option Explicit
'两个OptionBox , optMale , optFemale
'两个TextBox , txtAge , txtHeight
'一个CommandButton Command1
Private Sub Command1_Click()
If Me.optMale.Value Then '男
If CInt(txtAge.Text) < 18 Or CInt(txtAge.Text) > 20 Then
MsgBox "不符合 , 男性18~20岁"
Exit Sub
ElseIf CDbl(txtHeight.Text) < 1.65 Then
MsgBox "不符合 , 1.65米以上"
Exit Sub
Else
MsgBox "符合"
End If
Else '女
If CInt(txtAge.Text) < 16 Or CInt(txtAge.Text) > 18 Then
MsgBox "不符合 , 女性16~18岁"
Exit Sub
ElseIf CDbl(txtHeight.Text) < 1.6 Then
MsgBox "不符合 , 1.60米以上"
Exit Sub
Else
MsgBox "符合"
End If
End If
End Sub
[Dim nl, sg, d As Integer, s As String
nl = Val(tb2.Text)
sg = Val(tb3.Text)
If (rb1.Checked) And (nl >= 18 And nl <= 20) And sg >= 165 Then
s = "符合"
Else
s = "不符格"
If (rb2.Checked) And (nl >= 16 And nl <= 18) And sg >= 160 Then
s = "符合"
Else
s = "不符合"
End If
End If
tb1.Text = CStr(s)]
界面要看的话找我要