- 16
- 0
- 约7.24万字
- 约 172页
- 2017-03-30 发布于四川
- 举报
第2章节vb语言基本
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 在窗体上画一个命令按钮,名称为Command1。然后编写如下程序:Private Sub Command1_Click() Dim a As Integer Dim b As Integer For a = 1 To 4 For b = 0 To a Print Chr(65 + a); Next b Print Next a End Sub Evaluation only. Created with Aspose.Slides for .NET 3.5 Client Profile . Copyright 2004-2011 Aspose Pty Ltd. * 程序运行后,如果单击命令按钮,则在窗体上显示的内容是什么?BB CCC DDDD EEEEE Evaluation only. Created with Aspose.Slides for .NET 3.5 Client Profile . Copyright 2004-2011 Aspose Pty Ltd. * 在通用声明中定义a,在窗体中添加一个命令按钮Command1,编写如下程序代码: Dim?a?As?Integer Sub?test() a?=?a?+?1:?b?=?b?+?1:?c?=?c?+?1 Print?“Sub:”;a;b;c End?Sub Private?Sub?Command1_Click() a?=?2:?b?=?3:?c?=?4 Call?test Call?test End?Sub Evaluation only. Created with Aspose.Slides for .NET 3.5 Client Profile . Copyright 2004-2011 Aspose Pty Ltd. * 程序运行后,单击命令按钮,窗体中将显示(??) sub:3 1 1 sub:4 1 1 Evaluation only. Created with Aspose.Slides for .NET 3.5 Client Profile . Copyright 2004-2011 Aspose Pty Ltd. * Function f(a As Integer) b = 0 Static c b = b + 1 c = c + 1 f = a + b + c End Function Private Sub Command1_Click() Dim a As Integer a = 2 For i = 1 To 3 Print f(a) Next i End Sub 运行上面的程序,单击命令按钮,输出结果为: Evaluation only. Created with Aspose.Slides for .NET 3.5 Client Profile . Copyright 2004-2011 Aspose Pty Ltd. * 结果为: 4 5 6 Evaluation only. Created with Aspose.Slides for .NET 3.5 Client Profile . Copyright 2004-2011 Aspose Pty Ltd. * 设有如下程序: Private?Static?Function?fac(n?As?Integer)?As?Integer Dim?f?As?Integer f?=?f?+?n fac?=?f End?Function Private?Sub?Form_Click() Dim?i?As?Integer For?i?=?2?To?3 Print?#;?I =??fac(i) Next?i End?Sub 程序运行后,单击窗体,在窗体上显示的是(??) Evaluation only. Created with Aspose.Slides
原创力文档

文档评论(0)