为计算的值,并把结果显示在文本框Text1中,若编写如下事件过程: Private Sub Command1_Click Dim a%, s%,k% s=1 a=2 For k=2 To 10 a=a*2 s=s+a Next k Text1.Text=s End Sub 执行此事件过程后发现结果是错误的,为能够得到正确结果,应该做的修改是/ananas/latex/p/415072
举一反三
- 下面程序的输出结果是 Private Sub Command1_Click() ch$="ABCDEF" proc ch Print ch End Sub Private Sub proc(ch As String) S="" For k=Len(ch) To 1 Step-1 s=s & Mid(ch,k,1) Next k ch=s End Sub
- 在窗体上添加一个文本框,其名称为text1,然后编写如下的Load事件过程,则该程序的运行结果是______。Private Sub form_ load Text1. Text = " " t = 1 for k = 10 To 6 Step -2 t= t* k Next k Text1. Text = tEnd Sub A: 在文本框中显示120 B: 文本框中仍为空 C: 在文本框中显示480 D: 出错
- 运行下列程序,单击窗体显示的结果为( )。 Private Sub Form_Click() Dim a Dim s As Integer, i As Integer a = Array(1, 2, 3) For i = 2 To 0 Step -1 s = s + a(i) * a(i) Next i Print s End Sub
- 编写如下程序: Private Sub Command1_Click() Dim n As Integer : Static s As Integer For n = 1 To 3 s = s + n Next Print s End Sub 程序运行后,第三次单击命令按钮Command1时,输出结果为
- 在窗体上添加一个文本框,名称为text1,然后编写如下的load事件过程,则程序的运行结果是__________。 Private Sub Form_Load Text1.Text="" Text1.SetFocus For k=1 to 5 t=t*k Next k Text1.Text=t End Sub