SetFocus就是把当前焦点给某个对象,比如Me.SetFocus,则当前窗体或者焦点,也就是他是激活窗体,Text1.SetFocus,则Text1获得焦点,这时候输入的内容将显示在Text1中。但不知如何用在这个程序中;
将8楼的代码改了后:(没通过)
Private Sub Command1_Click()
Text1.Text = ""
K = 0
For I = 0 To 4
If Text1(I).Text <> "" Then '原来的:If Check1(I).Value <> 0 Then
K = K + 1
AA(K) = Text1(I).Text '原来的:AA(K) = Check1(I).Caption
End If
If Text2(I).Text <> "" Then 'If Check2(I).Value <> 0 Then
K = K + 1
AA(K) = Text2(I).Text 'AA(K) = Check2(I).Caption
End If
Next I
For I = 0 To 3
If Text3(I).Text <> "" Then 'If Check3(I).Value <> 0 Then
K = K + 1
AA(K) = Text3(I).Text 'AA(K) = Check3(I).Caption
End If
If Text4(I).Text <> "" Then 'If Check4(I).Value <> 0 Then
K = K + 1
AA(K) = Text4(I).Text ' AA(K) = Check4(I).Caption
End If
If Text5(I).Text <> "" Then 'If Check5(I).Value <> 0 Then
K = K + 1
AA(K) = Text5(I).Text 'AA(K) = Check5(I).Caption
End If
Next I
Dim SSA As String
For I = 1 To K - 1
For J = I + 1 To K
If AA(I) > AA(J) Then
SSA = AA(I)
AA(I) = AA(J)
AA(J) = SSA
End If
Next J
Next I
For I = 1 To K
If I < K Then
Text1.Text = Text1.Text & AA(I) & " - "
Else
Text1.Text = Text1.Text & AA(I)
End If
Next I
End Sub
将8楼的代码改了后:(没通过)
Private Sub Command1_Click()
Text1.Text = ""
K = 0
For I = 0 To 4
If Text1(I).Text <> "" Then '原来的:If Check1(I).Value <> 0 Then
K = K + 1
AA(K) = Text1(I).Text '原来的:AA(K) = Check1(I).Caption
End If
If Text2(I).Text <> "" Then 'If Check2(I).Value <> 0 Then
K = K + 1
AA(K) = Text2(I).Text 'AA(K) = Check2(I).Caption
End If
Next I
For I = 0 To 3
If Text3(I).Text <> "" Then 'If Check3(I).Value <> 0 Then
K = K + 1
AA(K) = Text3(I).Text 'AA(K) = Check3(I).Caption
End If
If Text4(I).Text <> "" Then 'If Check4(I).Value <> 0 Then
K = K + 1
AA(K) = Text4(I).Text ' AA(K) = Check4(I).Caption
End If
If Text5(I).Text <> "" Then 'If Check5(I).Value <> 0 Then
K = K + 1
AA(K) = Text5(I).Text 'AA(K) = Check5(I).Caption
End If
Next I
Dim SSA As String
For I = 1 To K - 1
For J = I + 1 To K
If AA(I) > AA(J) Then
SSA = AA(I)
AA(I) = AA(J)
AA(J) = SSA
End If
Next J
Next I
For I = 1 To K
If I < K Then
Text1.Text = Text1.Text & AA(I) & " - "
Else
Text1.Text = Text1.Text & AA(I)
End If
Next I
End Sub
[此贴子已经被作者于2018-2-22 13:55编辑过]