正在加载图片...
模块文 max 比较三个数x、y、z的大小,并返回大数m If x >y Then m =x Else m=y If m< z Then m=z End sub 3.(1)s<> (2)Mid(s,p+1) (3)Listl ListCount 4.程序代码如下: Private Sub Form Load Dim x As Single, n As Integer, y As Double x= InputBox("x=","求X的n次方") n= InputBox("n=","求X的n次方") Show Print x;"的":n:"次方="; Format(y,"##,#排#.#") End Sub Function Power( As Single, n As Integer)As Double If n> I then Power= Power(x, n-1)*x Else Power = x End function 5.创建一个新工程,建立二个窗体 Forml及Form2,把Form2设置为启动窗体。在 Forml中设置命 令按钮C1,Form2中设置命令按钮C2。 程序代码如下 Private Sub C1 Click 窗体 Forml的“隐藏”按钮 Forml hide nd Sub Private Sub C2 Click 窗体Form2的“显示”按钮 Forml Show End Sub 6.在窗体上设置三个窗体Form1~Form3 Forml中建立了两个文本框Text(用户名”和Text2(“密 码”),以及命令按钮 Command1(“判断”)。Form2中建立了一个文本框 TextI(其Text属性值为“欢迎你 使用本系统”)和命令按钮 Commandl(“返回”)。Form3中建立了一个文本框Text(其Text属性值为“对 不起,请向管理员查询”)和命令按钮 Command1(“退出”) Dim n As Integer Private Sub Command1 Click 窗体 FormI的“判断” usern Trim(TextI Text): passw Trim(Text2 Text) username And passw =password Then n=n+l: Text. setFocus If n= 3 Thel Forml Hide Form3. She End if End if Textl, Text = Text2 Text End Sub Private Sub Form activate TextI, Text = Text2 Text= Text Set Focu8 Text2.Text = m End Sub '标准模块文件 Sub max(x, y, z, m) '比较三个数 x、y、z 的大小,并返回大数 m If x > y Then m = x Else m = y If m < z Then m = z End Sub 3. (1) s<>"" (2) Mid(s, p+1) (3) List1.ListCount 4. 程序代码如下: Private Sub Form_Load() Dim x As Single, n As Integer, y As Double x = InputBox("x=", "求 X 的 n 次方") n = InputBox("n=", "求 X 的 n 次方") y = Power(x, n) Show Print x; "的"; n; "次方="; Format(y, "###,###.##") End Sub Function Power(x As Single, n As Integer) As Double If n > 1 Then Power = Power(x, n - 1) * x Else Power = x End If End Function 5. 创建一个新工程,建立二个窗体 Form1 及 Form2,把 Form2 设置为启动窗体。在 Form1 中设置命 令按钮 C1,Form2 中设置命令按钮 C2。 程序代码如下: Private Sub C1_Click() ‘窗体 Form1 的“隐藏”按钮 Form1.Hide End Sub Private Sub C2_Click() ‘窗体 Form2 的“显示”按钮 Form1.Show End Sub 6.在窗体上设置三个窗体 Form1~Form3。Form1 中建立了两个文本框 Text1(“用户名”)和 Text2(“密 码”),以及命令按钮 Command1(“判断”)。Form2 中建立了一个文本框 Text1(其 Text 属性值为“欢迎你 使用本系统”)和命令按钮 Command1(“返回”)。Form3 中建立了一个文本框 Text1(其 Text 属性值为“对 不起,请向管理员查询”)和命令按钮 Command1(“退出”)。 Dim n As Integer Private Sub Command1_Click() ‘窗体 Form1 的“判断” usern = Trim(Text1.Text):passw = Trim(Text2.Text) If usern = "username" And passw = "password" Then Form1.Hide Form2.Show Else n = n + 1:Text1.SetFocus If n = 3 Then Form1.Hide Form3.Show End If End If Text1.Text = "":Text2.Text = "" End Sub Private Sub Form_Activate() Text1.Text = "":Text2.Text = "" Text1.SetFocus
<<向上翻页向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有