list1'(itemDAte=aaa)
list2'(itemdate=ddds)
list3'(itemdate=eeg)
list4'(itemdate=ffa)
list5'(itemdate=ckdate)
list6'(itemdate=ckid)
比如说,拖动(或选中它后按一个上升的按钮)list6到list2的位置,变成
list1'(itemDAte=aaa)
list6'(itemdate=ckid)
list2'(itemdate=ddds)
list3'(itemdate=eeg)
list4'(itemdate=ffa)
list5'(itemdate=ckdate)
这个样子。(其中相对应的itemdate也对应)
用list还是dblist好
list2'(itemdate=ddds)
list3'(itemdate=eeg)
list4'(itemdate=ffa)
list5'(itemdate=ckdate)
list6'(itemdate=ckid)
比如说,拖动(或选中它后按一个上升的按钮)list6到list2的位置,变成
list1'(itemDAte=aaa)
list6'(itemdate=ckid)
list2'(itemdate=ddds)
list3'(itemdate=eeg)
list4'(itemdate=ffa)
list5'(itemdate=ckdate)
这个样子。(其中相对应的itemdate也对应)
用list还是dblist好
ListBox Name:"lstItems"
CommandButton:"cmdAdd","cmdDelete","cmdUp","cmdDown"'<<<<<<<<<<<<Code StartPrivate Sub cmdAdd_Click()
Dim sTmp As String
sTmp = InputBox("Enter new item to add:")
If Len(sTmp) = 0 Then Exit Sub
lstItems.AddItem sTmp
End SubPrivate Sub cmdDelete_Click()
If lstItems.ListIndex > -1 Then
If MsgBox("Delete '" & lstItems.Text & "'?", vbQuestion + vbYesNo) = vbYes Then
lstItems.RemoveItem lstItems.ListIndex
End If
End If
End SubPrivate Sub cmdUp_Click()
On Error Resume Next
Dim nItem As Integer
With lstItems
If .ListIndex < 0 Then Exit Sub
nItem = .ListIndex
If nItem = 0 Then Exit Sub 'can't move 1st item up
'move item up
.AddItem .Text, nItem - 1
'remove old item
.RemoveItem nItem + 1
'select the item that was just moved
.Selected(nItem - 1) = True
End With
End SubPrivate Sub cmdDown_Click()
On Error Resume Next
Dim nItem As Integer
With lstItems
If .ListIndex < 0 Then Exit Sub
nItem = .ListIndex
If nItem = .ListCount - 1 Then Exit Sub 'can't move last item down
'move item down
.AddItem .Text, nItem + 2
'remove old item
.RemoveItem nItem
'select the item that was just moved
.Selected(nItem + 1) = True
End With
End SubPrivate Sub lstItems_DragDrop(Source As Control, X As Single, Y As Single)
Dim i As Integer
Dim nID As Integer
Dim sTmp As String
If Source.Name <> "lstItems" Then Exit Sub
If lstItems.ListCount = 0 Then Exit Sub
With lstItems
i = (Y \ TextHeight("A")) + .TopIndex
If i = .ListIndex Then
'dropped on top of itself
Exit Sub
End If
If i > .ListCount - 1 Then i = .ListCount - 1
nID = .ListIndex
sTmp = .Text
If (nID > -1) Then
sTmp = .Text
.RemoveItem nID
.AddItem sTmp, i
.ListIndex = .NewIndex
End If
End With
SetListButtons
End SubSub lstItems_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = vbLeftButton Then lstItems.Drag
End SubPrivate Sub lstItems_Click()
SetListButtons
End SubSub SetListButtons()
Dim i As Integer
i = lstItems.ListIndex
'set the state of the move buttons
cmdUp.Enabled = (i > 0)
cmdDown.Enabled = ((i > -1) And (i < (lstItems.ListCount - 1)))
cmdDelete.Enabled = (i > -1)
End Sub'End>>>>>>>>>滿意嗎?