Visual Basic上机考试题(双号)的源代码
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
V isual Basic 上机考试题双号试题的源代码
第一种代码
Private Sub Command1_Click()
Label4.Caption = Text1.Text & "," & IIf(Option1.V alue, Option1.Caption, Option2.Caption) & "," & IIf(Option3.V alue, Option3.Caption, Option4.Caption) & "," & IIf(Check1.V alue = 1, _ "喜欢钓鱼", "") & "," & IIf(Check2.V alue = 1, _
"下棋", "") & "," & IIf(Check3.V alue = 1, _
"读书", "") & "," & IIf(Check4.V alue = 1, _
"打球", "")
End Sub
第二种代码
Private Sub Command1_Click()
Dim n As String, m As String, b As String, s As String, a As String, c As String, d As String
If Option1.V alue = True Then
n = Option1.Caption
ElseIf Option2.V alue = True Then
n = Option2.Caption
End If
Label4.Caption = n
If Option3.V alue = True Then
m = Option3.Caption
ElseIf Option4.V alue = True Then
m = Option4.Caption
End If
b = Text1.Text
If Check1.V alue = 1 Then
s = Check1.Caption
Else
s = ""
End If
If Check2.V alue = 1 Then
a = Check2.Caption
Else
a = ""
End If
If Check3.V alue = 1 Then
c = Check3.Caption
Else
c = ""
End If
If Check4.V alue = 1 Then
d = Check4.Caption
Else
d = ""
End If
Label4.Caption = b & "," & n & "," & m & "," & "喜欢:" & s & " " & a & " " & c & " " & d
End Sub。