vb题目会的来

来源:百度知道 编辑:UC知道 时间:2024/05/24 09:08:44
tk334.frm的功能是:从文本框Text1中输入一系列字符串,按回车键表示一个字符串的输入结束,将字符串存入数组中,当按下“排序”按钮时,按递减次序排列,并在图形框Picture1中显示排序后的结果,该程序不完整,请补充空白(1)、(2)处,以便能得到正确答案,但不得增删原语句。
Option Base 1
Dim n As Integer, s(100) As String

'n表示已输入字符串个数

Private Sub Command1_Click()
For i = 1 To n - 1
Max = i
For j = i + 1 To n
If (1) Then Max = j
Next j
temp = s(Max)
s(Max) = s(i)
s(i) = temp
Next i
For i = 1 To n
Picture1.Print s(i)
Next i
End Sub
Private Sub Text1_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Text1.Text = ""
Else
n = n + 1
(2)
End If
End Sub

(1):s(Max) < s(j)

(2):s(n) = Chr(KeyAscii)

这种需要计算或测试的题,你好歹悬赏点分吧.对你经济又没影响.

1.s(j)>s(i)
2.
s(n) = Chr(KeyAscii)
这道题目有点问题
你还必须在command1_click的最后一句加一个n=0
或者
Private Sub Text1_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Text1.Text = ""
n=0
Else
n = n + 1
(2)
End If
End Sub