|
![]() | 作者: shen [shen]
![]() |
登录 |
Private Type studtype name As String * 10 special As String * 10 total As Single End Type Private Sub Command1_Click(Index As Integer) Dim stud(1 To 100) As studtype, n%, i%, max!, maxi% Select Case Index Case 0 If n < 100 Then n = n + 1 i = n With stud(n) .name = Text1 .special = Text2 .total = Val(Text3) End With Text1 = "" Text2 = "" Text3 = "" Else MsgBox "输入人数超过数组声明的个数" End End If Case 1 If i > 1 Then i = i - 1 With stud(i) .name = Text1 .special = Text2 .total = Val(Text3) End With Case 2 If i < n Then i = i + 1 With stud(i) .name = Text1 .special = Text2 .total = Val(Text3) End With Case 3 max = stud(1).total For j = 2 To n If stud(j).total > max Then max = stud(j).total maxi = j End If Next With stud(maxi) Text1 = .name Text2 = .special Text3 = .total End With i = maxi End Select Label5 = i & "/" & n End Sub 用来记录学生的姓名,专业,和总分的 有四个按钮新增,前一个,后一个,最高分 [此贴被 shen(shen) 在 09月03日14时46分 编辑过] [此贴被 shen(shen) 在 09月03日15时24分 编辑过] |
地主 发表时间: 04-09-03 14:42 |
![]() | 回复: shen [shen] ![]() |
登录 |
这是我第二次的调试的结果 Private Type studtype name As String * 10 special As String * 10 total As Single End Type Private Sub Command1_Click(Index As Integer) Static n%, i% Dim stud(1 To 100) As studtype, max!, maxi% Select Case Index Case 0 If n < 100 Then n = n + 1 i = n With stud(i) .name = Text1 .special = Text2 .total = Val(Text3) End With Text1 = "" Text2 = "" Text3 = "" Else MsgBox "输入人数超过数组声明的个数" End End If Text1.SetFocus Case 1 If i > 1 Then i = i - 1 With stud(i) Text1 = .name Text2 = .special Text3 = .total End With Case 2 If i < n Then i = i + 1 With stud(i) Text1 = .name Text2 = .special Text3 = .total End With Case 3 max = stud(1).total maxi = 1 For j = 2 To n If stud(j).total > max Then max = stud(j).total maxi = j End If Next With stud(maxi) Text1.Text = .name Text2.Text = .special Text3.Text = .total End With i = maxi End Select Label5 = i & "/" & n End Sub 新增可以用了. 上一个,下一个,最高还是不能用 大家来看看,帮帮忙 _____________________________________________________________ 明天要靠今天努力 [此贴被 shen(shen) 在 09月03日15时26分 编辑过] [此贴被 shen(shen) 在 09月03日15时26分 编辑过] |
B1层 发表时间: 04-09-03 15:23 |
|
20CN网络安全小组版权所有
Copyright © 2000-2010 20CN Security Group. All Rights Reserved.
论坛程序编写:NetDemon
粤ICP备05087286号