Dim n%, s(100) As StringPrivate Sub Command1_Click()
le = UBound(s)
For i = 0 To le - 1
For j = le To i + 1 Step -1
If s(j) < s(j - 1) Then
t = s(j)
s(j) = s(j - 1)
s(j - 1) = t
End If
Next j
Next i
For i = 0 To le
Picture1.Print s(i) '问题:只有在s(i)后加“;”Picture1中才有输出,但是我
'要的是每输出一个字符串后回车,下一行再输出。可去掉“;”后
'Picture1中没有任何输出,请指教为什么。
Next i
End SubPrivate Sub Text1_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
s(n) = Text1.Text
n = n + 1
Text1.Text = ""
Text1.SetFocus
End If
End Sub
-----------------------
再一个问题:如果将Dim n%, s(100) As String声明为Dim n%, s(1 to 100) As String,那么
n的初始值就应该是1,可如果在通用段声明,就会提示错误,应该在那里初始化呢?
le = UBound(s)
For i = 0 To le - 1
For j = le To i + 1 Step -1
If s(j) < s(j - 1) Then
t = s(j)
s(j) = s(j - 1)
s(j - 1) = t
End If
Next j
Next i
For i = 0 To le
Picture1.Print s(i) '问题:只有在s(i)后加“;”Picture1中才有输出,但是我
'要的是每输出一个字符串后回车,下一行再输出。可去掉“;”后
'Picture1中没有任何输出,请指教为什么。
Next i
End SubPrivate Sub Text1_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
s(n) = Text1.Text
n = n + 1
Text1.Text = ""
Text1.SetFocus
End If
End Sub
-----------------------
再一个问题:如果将Dim n%, s(100) As String声明为Dim n%, s(1 to 100) As String,那么
n的初始值就应该是1,可如果在通用段声明,就会提示错误,应该在那里初始化呢?
第二个问题 把dim换成private