Listbox'ta seçili satırı buton ile aşağı yukarı kaydırmak istiyorum. Nette örnekleri var ama multi column olarak bulamadım. Benim Listbox'ımda 12 sutun var. Formda da böyle bir örnek ile karşılaşmadım. Satırın komple taşınmasını istiyorum.
DOSYA İndirmek/Yüklemek için ÜCRETLİ ALTIN ÜYELİK Gereklidir!
Altın Üyelik Hakkında Bilgi
Private Sub SpinButton1_SpinDown()
MoveItemListBox myListBox1, 1
End Sub
Private Sub SpinButton1_SpinUp()
MoveItemListBox myListBox1, -1
End Sub
Private Sub MoveItemListBox(ByVal lstBx, lOffset As Long)
Dim i As Long, i2 As Long
Dim leaveAlone As Boolean
Dim pos As Long
Dim lstBgn As Long, lstEnd As Long
Dim Temp As String
If Sgn(lOffset) = 1 Then
lstBgn = UBound(lstBx.List)
lstEnd = LBound(lstBx.List)
Else
lstBgn = LBound(lstBx.List)
lstEnd = UBound(lstBx.List)
End If
pos = lstBgn
With lstBx
For i = lstBgn To lstEnd Step -Sgn(lOffset)
If .Selected(i) Then
If i = pos Then Exit For
For i2 = 0 To .ColumnCount - 1
Temp = IIf(IsNull(.List(i + lOffset, i2)), "", .List(i + lOffset, i2))
.List(i + lOffset, i2) = .List(i, i2) 'hata veriyor'
.List(i, i2) = Temp
.ListIndex = i + lOffset
.Selected(i) = False
.Selected(i + lOffset) = True
Next
End If
Next
End With
End Sub