计算机类二级VB

二级VB上机题库5

10 题含答案VB
共 10 题返回本类
1材料分析题1 / 10
  
查看答案
Private Sub Command1_Click()
    Height = 1.2 * Me.Height
    Me.Width = Width * 1.2
End Sub
Private Sub Command2_Click()
    Left = Left + 200
    Top = Top + 100
End Sub
2材料分析题2 / 10
  
查看答案
Private Sub HScroll1_Change()
    Label1.Left = Me.HScroll1
End Sub
Private Sub HScroll1_Scroll()
    Label1.Left = Form1.HScroll1
End Sub
3材料分析题3 / 10
  
查看答案
Private Sub HScroll1_Change()
    Timer1.Interval = HScroll1.Value
End Sub
Private Sub Timer1_Timer()
    Image1.Visible = Not Image1.Visible
End Sub
4材料分析题4 / 10
  Private Sub HScroll1_Change()
'    Text1.FontSize = ?
    If List1.Text <> "" Then
'        Text1.FontName = ?
    Else
        MsgBox "请选择字体", , ""
    End If
End Sub
查看答案
Private Sub HScroll1_Change()
    Text1.FontSize = HScroll1.Value
    If List1.Text <> "" Then
        Text1.FontName = List1.Text
    Else
        MsgBox "请选择字体", , ""
    End If
End Sub
5材料分析题5 / 10
  Private Type Paltype
    Name As String * 8
    Tel As String * 10
    Post As Long
End Type
查看答案
'考生编写如下事件过程的程序(Command1_Click)
Private Sub Command1_Click()
    Dim Pal As Paltype
    Open App.Path & "\in5.txt" For Random As #1 Len = Len(Pal)
    Get #1, 3, Pal
    Text1.Text = Pal.Name
    Text2.Text = Pal.Tel
    Text3.Text = Str(Pal.Post)
    Close 1
End Sub
Private Sub Command2_Click()
    Open App.Path & "\out5.txt" For Output As #1
    Print #1, Text1.Text, Text2.Text, Text3.Text
    Close 1
End Sub
6材料分析题6 / 10
  
查看答案
Private Sub HScroll1_Change()
  Text1 = HScroll1
End Sub
VERSION 5#
Begin VB.Form Form1
  Caption = "Form1"
  ClientHeight = 1935
  ClientLeft = 60
  ClientTop = 345
  ClientWidth = 4380
  LinkTopic = "Form1"
  ScaleHeight = 1935
  ScaleWidth = 4380
  StartUpPosition = 3    '窗口缺省
  Begin VB.TextBox Text1
      Height = 375
      Left = 1560
      TabIndex = 1
      Top = 360
      Width = 1335
  End
  Begin VB.HScrollBar HScroll1
      Height = 375
      LargeChange = 50
      Left = 480
      Max = 1500
      Min = 1000
      SmallChange = 2
      TabIndex = 0
      Top = 1080
      Value = 1000
      Width = 3375
  End
End
Private Sub HScroll1_Change()
  Text1 = HScroll1
End Sub
7材料分析题7 / 10
  
查看答案
Private Sub Form_Click()
    'Form1.C1.Left = 100 + Me.C1.Left
    'Me.C1.Top = 100 + Form1.C1.Top
    C1.Move 100 + C1.Left, 100 + C1.Top
End Sub
8材料分析题8 / 10
  Private Sub C1_Click()
'题目:
'    For i = ? To ?
'        If Op1(i).? = True Then
'            Print "我是" + Op1(i).?
'        End If
'    Next
查看答案
'正确程序:
    For i = 0 To 2
        If Op1(i).Value = True Then
            Print "我是" + Op1(i).Caption
        End If
    Next
End Sub
'答案:
'0
'2
'value
'Caption
9材料分析题9 / 10
  Private Sub Command1_Click()
    Timer1.Enabled = True
End Sub
Private Sub Timer1_Timer()
'    If Val(?) = 0 Then
        Text1.Text = ""
'        Timer1.? = False
'        Text1.?
    Else
        Text1.Text = Str(Val(Text1.Text) - 1)
    End If
End Sub
查看答案
Private Sub Command1_Click()
    Timer1.Enabled = True
End Sub
Private Sub Timer1_Timer()
    If Val(Text1.Text) = 0 Then
        Text1.Text = ""
        Timer1.Enabled = False
        Text1.SetFocus
    Else
        Text1.Text = Str(Val(Text1.Text) - 1)
    End If
End Sub
10材料分析题10 / 10
  
Private Type PalInfo
    Name As String * 8
    Tel As String * 10
    Post As Long
End Type
Dim pal As PalInfo
Private Sub Command2_Click()
    ch$ = ""
    For k = 1 To Len(Text1.Text)
        C$ = Mid$(Text1.Text, k, 1)
        If C$ >= "0" And C$ <= "9" Or C$ >= "a" And C$ <= "z" Or C$ >= "A" And C$ <= "Z" Then
            ch$ = ch$ + C$
        End If
    Next k
    Open App.Path & "\out5.txt" For Output As #1
    Print #1, ch$
    Close #1
End Sub
查看答案
Private Sub Command1_Click()
'考生应编写的程序
    Open App.Path & "\in5.txt" For Random As #1 Len = Len(pal)
    For i = 1 To 5
        Get #1, i, pal
        Text1.Text = Text1.Text & pal.Name
        Text1.Text = Text1.Text & pal.Tel
        Text1.Text = Text1.Text & Str(pal.Post)
        Text1.Text = Text1.Text + vbCrLf
    Next
    Close 1
End Sub
← 上一卷下一卷 →