投稿日 | : 2006/04/10(Mon) 18:24 |
投稿者 | : GOD |
Eメール | : |
URL | : |
タイトル | : Re^5: 追記 |
テキストボックスだけのソートじゃないのか。orz
じゃ、↓みたいな感じかな。
Private Sub Command2_Click()
Dim lngSort() As Long
Dim lngChanged As Long
Dim i As Long
Dim j As Long
ReDim lngSort(txtSort.Count - 1)
For i = LBound(lngSort) To UBound(lngSort)
lngSort(i) = CLng(txtSort(i).Text)
Next
For i = LBound(lngSort) To UBound(lngSort) - 1
For j = i + 1 To UBound(lngSort)
If lngSort(i) > lngSort(j) Then
lngChanged = lngSort(i)
lngSort(i) = lngSort(j)
lngSort(j) = lngChanged
End If
Next
Next
For i = LBound(lngSort) To UBound(lngSort)
List1.AddItem CStr(lngSort(i))
Next
End Sub
または予めListのSortedをTrueにして↓とか。(FontはPなしの3の倍数が見栄えが良い。)
Private Sub Command3_Click()
Dim lngMaxDigit As Long
Dim i As Long
lngMaxDigit = 0
For i = 0 To txtSort.Count - 1
If lngMaxDigit < Len(txtSort(i).Text) Then
lngMaxDigit = Len(txtSort(i).Text)
End If
Next
For i = 0 To txtSort.Count - 1
List1.AddItem Space(lngMaxDigit - Len(txtSort(i).Text)) & txtSort(i).Text
Next
End Sub