计算机类二级VB

二级VB上机题库6

10 题含答案VB
共 10 题返回本类
3材料分析题3 / 10
  
查看答案
Private Sub C1_Click()
    Form1.Visible = False
End Sub
Private Sub C2_Click()
    Form1.Visible = True
End Sub
4材料分析题4 / 10
  
Private Sub C1_Click()
'题目:
'    If HS1.Value + Text1.Text > HS1.? Then
'        MsgBox "文本框中的数值太大"
'    ElseIf HS1.Value + Text1.Text < ? Then
'        MsgBox "文本框中的数值太小"
'    Else
'        ? = HS1.Value + Text1.Text
'    End If
查看答案
'正确程序
    If HS1.Value + Text1.Text > HS1.Max Then
        MsgBox "文本框中的数值太大"
    ElseIf HS1.Value + Text1.Text < HS1.Min Then
        MsgBox "文本框中的数值太小"
    Else
        HS1.Value = HS1.Value + Text1.Text
    End If
End Sub
'答案
'Max 或 100
'HS1.Min 或 1
'HS1.Value
5材料分析题5 / 10
  
查看答案
Private Sub C1_Click()
    Open "in5.txt" For Input As #1
    Input #1, a$
    Text1.Text = a$
    Close #1
End Sub
Private Sub C2_Click()
    a$ = Text1.Text
    b$ = ""
    n = Len(a$)
    For i = 1 To n
        b$ = b$ + UCase$(Mid$(a$, i, 1))
    Next
    Text1.Text = b$
End Sub
Private Sub C3_Click()
    Open "out5.txt" For Output As #1
    Print #1, Text1.Text
    Close #1
End Sub
7材料分析题7 / 10
  
查看答案
Private Sub Form_DblClick()
    P1.Picture = LoadPicture()
    '或  P1.Picture = LoadPicture("")
End Sub
9材料分析题9 / 10
  
Private Sub C1_Click()
'题目
    For i = 0 To Me.l1.ListCount - 1
        If l1.Selected(i) = True Then
            Print l1.List(i)
        End If
    Next
End Sub
查看答案
'答案
'0
'4  或  L1.ListCount-1
'Selected(i)
10材料分析题10 / 10
   
'提供给考生的程序
Private Sub Form_Unload(Cancel As Integer)
    Open App.Path & "\out5.txt" For Output As #1
    Print #1, Op1.Value, Op2.Value, Text1.Text
    Close #1
End Sub
查看答案
'要求考生编写的程序
Private Sub C1_Click()
    If Op1.Value Then
        Text1.Text = fun(7)
    End If
    If Op2.Value Then
        Text1.Text = fun(3)
    End If
End Sub
Private Function fun(a As Integer) As Integer
    s% = 0
    For i% = 500 To 600
        If Int(i% / a) = i% / a Then
            s% = s% + i%
        End If
    Next
    fun = s%
End Function
← 上一卷下一卷 →