• 2022-06-06
    设工程中有Form1、Form2两个窗体,要求单击Form2上的Command1命令按钮,Form2就可以从屏幕上消失,下面的事件过程中不能实现此功能的是
    A: Private Sub Command1_Click() Form2.Hide End Sub
    B: Private Sub Command1_Click() Unload Me End Sub
    C: Private Sub Command1_Click() Form2.Unload End Sub
    D: Private Sub Command1_Click() Me.Hide End Sub
  • C

    举一反三

    内容

    • 0

      在窗体中添加一个通用对话框Commondialog1和一个命令按钮Command1,当单击按钮时,打开颜色对话框,能实现此功能的程序段是 A: Private Sub Command1_Click( ) Commondialog1.ShowOpen End Sub B: Private Sub Command1_Click( ) Commondialog1.ShowColor End Sub C: Private Sub Command1_Click( ) Commondialog1.ShowOpen Commondialog1.ShowFont End Sub D: Private Sub Command1_Click( ) Commondialog1.ShowColor Commondialog1.ShowHelp End Sub

    • 1

      窗体中有3个命令按钮,分别命名为Commandl、Command2和Command3。当单击Cmmandl按钮时,Command2按钮变为可用,Command3按钮变为不可见。下列Commandl的单击事件过程中,正确的是( ) A: Private Sub Command1_Click() Command2.Visible=True Command3.Visible=False End Sub B: Private Sub Command1_Click() Command2.Enabled=True Command3.Enabled=False End Sub C: Private Sub Command1_Click() Command2.Enabled=True Command3.Visible=False End Sub D: Private Sub Command1_Click() Command2.Visible=True Command3.Enabled=False End Sub

    • 2

      下列( )事件过程可以将打开文件对话框的标题改变为“new Caption”。 A: Private Sub Command1_CliCk() CommonDialog1.DialogTitle="new Caption" CommonDialog1.ShowFont End Sub B: Private Sub Command1_Click() CommonDialog1.DialogTitle="new Caption" CommonDialog1.ShowOpen End Sub C: Private Sub Command1_Click() CommonDialog1.DialogTitle="new Caption" CommonDialog1.Show Help End Sub D: Private Sub Command1_Click() CommonDialog1.DialogTitle="new Caption" CommonDialog1.ShowColor End Sub

    • 3

      在名为“Form1”的窗体上添加三个文本框和一个命令按钮,其名称分别为“txt1”、“txt2”、“txt3”和“Command1”,然后编写如下两个事件过程: Private Sub Command1_Click() txt3=txt1+txt2 End Sub Private Sub Form l_Load() txt1=" " txt2=" " txt3=" " End Sub 当打开窗体Form 1后,在txt1和txt2中分别输入3和5,然后单击命令按钮Command1,则文本框txt3中显示的内容为______。

    • 4

      声明一个变量为局部变量应该用( )。 A: Private Sub Command1 Click() n=5:x=1 Do X=X * I I=I + 1 Loop While I < n Print x End Sub B: Private Sub Command1_Click() n=5:X=1:I=1 Do X=X*I I=I + 1 Loop While I <n Print x End Sub C: Private Sub Command1_Click() n=5:X=1:I=1 Do X=X * I I=I + 1 Loop While I<=n Print X End Sub D: Private Sub Command1_Click() n=5:X=1:I=1 Do X=X * I I=I + 1 Loop While I>n Print X End Sub