本栏目下题库来源于互联网,轻速云承诺对于用户导入平台的题库是严格保密的,不会在此呈现!
轻速云给您提供更好的在线考试系统服务!
二级VB上机题库17
1、【 简答题
    
Dim which As Integer
Private Sub copy_Click()
    If which = 1 Then
        Text3.Text = Text1.Text
    ElseIf which = 2 Then
        Text3.Text = Text2.Text
    End If
End Sub
Private Sub cut_Click()
    If which = 1 Then
        Text3.Text = Text1.Text
        Text1.Text = ""
    ElseIf which = 2 Then
        Text3.Text = Text2.Text
        Text2.Text = ""
    End If
End Sub
Private Sub edit_Click()
'    If which = ? Then
        If Text1.Text = "" Then
            cut.Enabled = False
            copy.Enabled = False
        Else
            cut.Enabled = True
            copy.Enabled = True
        End If
'    ElseIf which = ? Then
        If Text2.Text = "" Then
            cut.Enabled = False
            copy.Enabled = False
        Else
            cut.Enabled = True
            copy.Enabled = True
        End If
    End If
    If Text3.Text = "" Then
        paste.Enabled = False
    Else
        paste.Enabled = True
    End If
End Sub
Private Sub paste_Click()
    If which = 1 Then
'        Text1.Text = ?
    ElseIf which = 2 Then
'        Text2.Text = ?
    End If
End Sub
Private Sub Text1_GotFocus()  '本过程的作用是:当焦点在Text1中时,which = 1
    which = 1
End Sub
Private Sub Text2_GotFocus()  '本过程的作用是:当焦点在Text2中时,which = 2
    which = 2
End Sub [10分]
解析:
Dim which As Integer
Private Sub copy_Click()
    If which = 1 Then
        Text3.Text = Text1.Text
    ElseIf which = 2 Then
        Text3.Text = Text2.Text
    End If
End Sub
Private Sub cut_Click()
    If which = 1 Then
        Text3.Text = Text1.Text
        Text1.Text = ""
    ElseIf which = 2 Then
        Text3.Text = Text2.Text
        Text2.Text = ""
    End If
End Sub
Private Sub edit_Click()
    If which = 1 Then
        If Text1.Text = "" Then
            cut.Enabled = False
            copy.Enabled = False
        Else
            cut.Enabled = True
            copy.Enabled = True
        End If
    ElseIf which = 2 Then
        If Text2.Text = "" Then
            cut.Enabled = False
            copy.Enabled = False
        Else
            cut.Enabled = True
            copy.Enabled = True
        End If
    End If
    If Text3.Text = "" Then
        paste.Enabled = False
    Else
        paste.Enabled = True
    End If
End Sub
Private Sub paste_Click()
    If which = 1 Then
        Text1.Text = Text1 + Text3.Text
    ElseIf which = 2 Then
        Text2.Text = Text2 + Text3.Text
    End If
End Sub
Private Sub Text1_GotFocus()  '本过程的作用是:当焦点在Text1中时,which = 1
    which = 1
End Sub
Private Sub Text2_GotFocus()  '本过程的作用是:当焦点在Text2中时,which = 2
    which = 2
End Sub
2、【 简答题
    [10分]
解析:
  按要求解答即可
3、【 简答题
    [10分]
解析:
  按要求解答即可
4、【 简答题
    
Dim a(15) As String
Private Sub C1_Click()
    Dim k As Integer
    Open "in5.txt" For Input As #1
    Form1.Cls
    For k = 1 To 15
        Input #1, a(k)
        Print a(k)
    Next k
'    Close ?
End Sub
Private Sub C2_Click()
    Dim k As Integer, n As Integer, c As String
'    n = Len( ? )
    c = ""
    If n > 0 Then
        For k = 1 To 15
'            If Left(a(k), ? ) = Text1.Text Then
'                c = c + "  " + ?
            End If
        Next k
        If c = "" Then
            Text2.Text = "未找到!"
        Else
'            Text2.Text = ?
        End If
    Else
        Text2.Text = "未输入查找内容!"
    End If
End Sub [10分]
解析:
Dim a(15) As String
Private Sub C1_Click()
    Dim k As Integer
    Open "in5.txt" For Input As #1
    Form1.Cls
    For k = 1 To 15
        Input #1, a(k)
        Print a(k)
    Next k
    Close #1
End Sub
Private Sub C2_Click()
    Dim k As Integer, n As Integer, c As String
    n = Len(Text1.Text)  'Text1
    c = ""
    If n > 0 Then
        For k = 1 To 15
            If Left(a(k), n) = Text1.Text Then
'            If Left(a(k), Len(Text1)) = Text1.Text Then
'            If Left(a(k), Len(Text1.Text)) = Text1.Text Then
                c = c + "  " + a(k)
            End If
        Next k
        If c = "" Then
            Text2.Text = "未找到!"
        Else
            Text2.Text = c
        End If
    Else
        Text2.Text = "未输入查找内容!"
    End If
End Sub
5、【 简答题
   Dim a(100) As Integer
Private Sub Command1_Click()
    Dim k As Integer
    Open App.Path & "\in3.dat" For Input As #1
    For k = 1 To 100
        Input #1, a(k)
    Next k
    Close #1
End Sub
Private Sub Command2_Click()
  '需考生编写 [10分]
解析:
Max = a(1)
    Min = a(1)
    For i = 2 To 100
        If isnarc(a(i)) = True Then
          If a(i) > Max Then Max = a(i)
          If a(i) < Min Then Min = a(i)
        End If
    Next
    Text1.Text = Max
    Text2.Text = Min
End Sub
'以下Function 过程用于判断某数是否为水仙花数
Function isnarc(p As Integer)
  x = Fix(p / 100)
  y = Fix((p - x * 100) / 10)
  z = p - x * 100 - y * 10
  If p = x ^ 3 + y ^ 3 + z ^ 3 Then
      isnarc = True
  Else
      isnarc = False
  End If
End Function
Private Sub Form_Unload(Cancel As Integer)
    Open App.Path & "\out3.dat" For Output As #1
    Print #1, Val(Text1.Text)
    Print #1, Val(Text2.Text)
    Close #1
End Sub
6、【 简答题
    [10分]
解析:
Private Sub Command1_Click()
    If Op1.Value Then
        Text1.FontName = Op1.Caption
    ElseIf Op2.Value Then
        Text1.FontName = Op2.Caption
    End If
    If Ch1.Value = 1 Then
        Text1.FontUnderline = True
    Else
        Text1.FontUnderline = False
    End If
    If Ch2.Value = 1 Then
        Text1.FontItalic = True
    Else
        Text1.FontItalic = False
    End If
End Sub
Private Sub Form_Unload(Cancel As Integer)
    unload_sub
End Sub
7、【 简答题
    [10分]
解析:
Private Sub C1_Click()
    Dim n As Integer, k As Integer, s As Long
    n = Val(Cb1.Text)
    s = 0
    For k = n To 5000
        If k / n = Int(k / n) Then
            s = s + k
        End If
    Next k
    Text1.Text = s
End Sub
Private Sub Form_Unload(Cancel As Integer)
    unload_sub
End Sub
8、【 简答题
    [10分]
解析:
Private Sub C1_Click()
    Image1.Width = Image1.Width + 100  '或    Image1.Width = 100 + Image1.Width
    Image1.Height = Image1.Height + 100 '或    Image1.Height = 100 + Image1.Height
End Sub
Private Sub C2_Click()
    Image1.Width = Image1.Width - 100  '或    Image1.Width = -100 + Image1.Width
    Image1.Height = Image1.Height - 100 '或    Image1.Height = -100 + Image1.Height
End Sub
9、【 简答题
    [10分]
解析:
Private Sub Command1_Click()
    Dim n As Long
    CD1.FileName = ""
    CD1.Filter = "所有文件|*.*|文本文件|*.txt|Word文档|*.doc"
    CD1.FilterIndex = 2
'    CD1.ShowOpen
    CD1.Action = 1
    If CD1.FileName <> "" Then
        Open CD1.FileName For Input As #1
        n = LOF(1)
        Text1 = Input$(n, #1)
'      Close #1
      Close 1
    End If
End Sub
10、【 简答题
    [10分]
解析:
Private Sub Text1_Change()
    Text2.Text = Text1.Text
'或    Text2.Text = Text1
'或    Text2 = Text1.Text
'或    Text2 = Text1
End Sub
1
1页,共10个题库
1页,共10个题库
轻速云给您提供更好的在线考试系统服务!
推荐
推荐题库
众多企事业单位的信赖之选
36万+企事业单位的共同选择
查看更多合作案例
众多企事业单位的信赖之选
开始使用轻速云组织培训考试
四步组织一场考试答题,一键搭建企业培训平台
免费使用 免费使用 预约演示
咨询热线
400-886-8169
周一到周日 8:00-22:00
©2023 轻速云 苏ICP备16049646号-1 轻速云科技提供专业的在线考试系统、在线培训系统
联系我们
客服热线客服热线:400-886-8169 | 周一至周日 8:00-22:00
©2023 轻速云 苏ICP备16049646号-1
轻速云科技提供专业的在线考试系统、在线培训系统
在线咨询 400-886-8169