Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
 
  HOME    TRACKER    Visual Basic




Move Item Up Or Down In ListView


Can you move an item up or down in a listview like a drag and drop or something any type really

vbMarkO




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
How To Move An Item In A Listview
I have a listview in report mode. I would like to be able to move one of the items to the top of the list and push all the others down. The index property is read only unforunatly although I can still Add new threads to the top and push all the indexes down. Do I just have to use .Add and .Remove or am I missing the .Move method?

How To Move Up Or Down Item In The Listview
Hi,
Does anybody know how to resort the order in the listview? I want to select one item and click "Up" to let it move up, or vice versa.

In addition, the MultiSelected property of the listview is seted to True. If the user select multiple items and click "Up" or "Down", how can I know? I cannot find any property like selcount can let me know if the user select multiple items. I do not want to use a loop to check the Selected property of each listitems.How can I do?

Thanks in advance. :-)

Michi

Move Listview Item?
I have a listview (report mode) that I use to display a database. I then have a search option for that listview. When I do a search I want all the items that match to be placed at the top of the listview and higlighted (selected)! I can get the highlighting with no problem, I just cant figure out how the re-index the items? So something like:
listview.listitems(someNumber).index = 1
... but that doesnt work.
Any help is greatly appreciated, thanks!

Listview Move Selected Item Up Or Down
hi ,...

i would like to know how can i move a selected item in the listview up or down ?!

i tried :


Code:
listview1.selecteditem.index=listview1.selecteditem.index-1
or
listview1.selecteditem.index =listview1.selecteditem.index +1

but this is not working !!
anyone can help me please !?

thanks in advance ..

Move Listview Item To Top Of The List
Hi, does anybody know how to move a Listview item to the top of the list?

I'd like to loop through the Listview and move all items that contain certain text to the top.

Move To Item In Listview By KeyPress
I have a database which i currently load into a Listview and sort when it loads. Now i'm trying to enable the user to press a key and have the listview move to that row. Just like in the windows explorer window. The sort will have to be done using the second column because the first column is numbers and the second is the name of a project. Or if there is a better way to show this info and sort it using a different type of view. Any help would be great.

Thanks,
Stan

How To Move Listview Item Blue Highlight While Looping Within It?
Hi all.I got this listview and i am looping within it but how to make the listview hightlight move each time i loop within its item. Now i don't see any highlight at all!!
:

2 Code:
Private Sub Command2_Click()
Dim i As Long
For i = 1 To ListView1.ListItems.Count

    txtURL = ListView1.ListItems(i).Text
    'ListView1.SelectedItem(i) = True
    txtURL = ListView1.ListItems(i)
    Dim completeurl As String
    completeurl = "http://localhost/script.php?s=" & txtURL.Text
  ListView1.ListItems(i).SubItems(2) = Inet1.OpenURL(completeurl, icString)

End Sub

###MoVe Items In A ListBOX! Simple Help! Like I Want To Move An Item One Down ###
Hi every1,

ANy1 knws any quick way by which i can move items in a listbox?
Like i have a list box and when i click a button i want the time to be move down by one item in the list or move up by one item...

cud any1 suggest a good method?


thx

Click Item In Listview Then Show That Item In Combo As Index = 0
Hi guys,

I have a listview (lvwUserPunchedOut) that is populated with records in a database (persons first name in one column and last name in the second column), what I am looking to do is if I select a persons name by clicking on it in the listview on frmMain, and then bring up frmSearchCriteria, i would like to show that selected name in the combobox as default (cboEmployee.ListIndex = 0) on frmSearchCriteria (the combobox is sorted = True and is also populated with first name and last name of the person)

How would this be done? Hope I make sense. Thanks in advance.

Move ListBox Item Up Or Down
Just wanted to make a small contribution to the forum. I looked around for this but didn't find anything really to my liking, so here's my version...


Code:
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'Move Selected listbox item up or down
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Option Explicit
const UP as integer = -1
const DOWN as integer = 1

Private Sub btnUp_Click()

If Me.lstDisplayCols.ListCount > 1 Then
Call MoveListItem(UP, Me.lstDisplayCols)
End If

End Sub

Private Sub btnDown_Click()

If Me.lstDisplayCols.ListCount > 1 Then
Call MoveListItem(DOWN, Me.lstDisplayCols)
End If

End Sub

Private Sub MoveListItem(ByVal intDirection As Integer, _
ByRef lstListBox As ListBox)

Dim intNewPosition As Integer
Dim strTemp As String

intNewPosition = lstListBox.ListIndex + intDirection
strTemp = lstListBox.List(intNewPosition)

If intNewPosition > -1 _
And intNewPosition < lstListBox.ListCount Then

'Swap listbox items
lstListBox.List(intNewPosition) = lstListBox.Text
lstListBox.List(intNewPosition - intDirection) = strTemp
lstListBox.Selected(intNewPosition) = True

End If

End Sub

the lstDisplayCols listbox is a list of selected columns to be displayed for a search result list. Just put the name of your list box there...

Move Item In The Listbox
How to move Item from the first index to second index one by one until last index. I have select the item. I want to move it down,just change the position. Code below does not works



Code:
For c = 0 To ListBox1.ListCount - 1

If ListBox1.Selected(c) = True Then
Dim idx As Integer
idx = ListBox1.ListIndex
If ListBox1.ListIndex > 0 Then
ListBox1.ListIndex = idx - 1

End If

End If
Next

Move Item In List
how do you move an item up or down in a listbox???

thnx,
squirrelly1

Move A Item In A List Box
If I forget to put an item in a list box. Can I put it in and move it where it needs to be.

Thank you for your help

I would like to move it with the mouse

Move ListBox To The Last Item
How do I move a listbox to the last Item?

Note: I use VB 3.0


Thanks for some help

Locking Item Move .. Need Help ..
Hello,
i writing a code for 2 picture boxs .. one inside one .. and its move with mouse move when draging it ..
my problem is i want to lock the inside image into the big frame picture box ..
this is my code

Code:Private Sub inside_MouseDown(Button As Integer, Shift As Integer, x As Single, y As Single)
    If Button = vbLeftButton Then
        xx = x
        yy = y
        inside.MousePointer = vbSizeAll
    End If
End Sub
----------------------------
Private Sub inside_MouseMove(Button As Integer, Shift As Integer, x As Single, y As Single)
        With inside    
             If Button = vbLeftButton Then
                  .Left = (.Left - xx) + x
                  .Top = (.Top - yy) + y
            End If
        End With
End Sub
----------------------------
Private Sub inside_MouseUp(Button As Integer, Shift As Integer, x As Single, y As Single)
inside.MousePointer = vbNormal
End Sub

i tried to check the top and left for inside image .. if thay are -1 .. makes them 0 and exit the mouse move sub ..
but its not working good .. i dont know why
any one have a good solutions .. ?

Thanks in advanced

Move Item In List?
Hi guys!
I have a listbox which is populated by the user with pre-defined items. What i want to do is add two buttons
that allows the user to move the selected item up or down in the list. I have the below code (move down)
which seems to be on the right track, but it moves the selected item to the bottom of the list. I want it to go
just one step down, and the item under it one step up. Does anyone have any suggestions? And how would
i edit the code for the "move up" button?
Code:
Private Sub Command17_Click()
Dim x As Integer
    For x = List2.ListCount - 1 To 0 Step -1
        If List2.Selected(x) Then
            List2.AddItem (List2.List(List2.ListIndex))
            List2.RemoveItem (List2.ListIndex)
        End If
    Next
End Sub

Cheers!
Maverick



Edited by - Maverick2004 on 2/5/2005 12:51:27 AM

Move Selected List Item Up Or Down?
Hi.
Is it possible to move a list item up or down?
If yes can you give me the code to do it?
Thanks

Move Item Inside Listbox (up And Down)
Hey, anyone with a simple code for moving items up or down in a lsitbox?
I mean if you have the items 1 - 5 in a listbox,and you would like
the item5 to become item2, then you simply click item5, hold button and drop where item2 is and then we get a list that looks like this:

NEW: ----- ORGINAL:
item1 ------ item1
item5 ------ item2
item2 ------ item3
item3 ------ item4
item4 ------ item5

Do you understand what i want? lets say its equal to winamp's behavior, for example...

Please help! PS: keep the code as simple as possible!

Move List Item Up And Down In Listbox
How do I move a line up and down in a listbox?

Move Item In Listbox With The Mouse
If I forget to put an item in a list box. Can I put it in and move it where it needs to be with the mouse


Thank you for your help

Mouse Move On Item Listbox Or Combobox
possibke to have the same effect on items in a VBA combobox for Excel?
Tks.

http://delphi.about.com/library/weekly/aa102604a.htm

Quick Listbox Questions (Move To Next Item)
Simple: Listbox and cmd button.

When I click the command button, the selected listbox item should move to the next item in the listbox. Click the cmd button again and the selected entry in the listbox should move to the next one.

Any help?

TreeView Move Control To Selected Item
Hi All,

What i'm after is when a user selects a child i want to move and display a datepicker control to that position?

Any ideas??

thanks for any help!
b

Move TextBox To Listbox Item Position
I have a list box with checkboxes., with say 10 items in the list.

I need to edit the item contained on a particular list box item.  ie....I click on the check box in item 3.

Private Sub List1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
Text1.Move X, Y
End Sub

This does move the text box to the 3rd line of the list box
but not the horizontal position.

I would like to get the text box directly over the list box item., so i can type in the altered info and then place this data in the list box (ie replace)

Appreciate any ideas of how to do this


How To Move Cursor To Next Item ( Text Box) With Out Pressing Tab Or Clicking Mouse
Hellow Freinds

I am New in VB, Started Developing Applications.

Please let me how to Move to Next Item ( Text Box) with out Pressing Tab
or Clicking Mouse.

Eg. I am Having tow Text Boxes Text1 and Text2

Field Length of Text1 is Fixed as 3 Charectors, one user input 3
charecter Cursor should move to Text2 with out Pressing

TAB or Enter Key.

Please Help me

Thanks in Advance



DVK

Moving A Listview Item And Its Subitems To A New Listview
Hey Guys,

Having a bit of trouble. I am attemping to move a selected item and its subitems from one listview to another. I have no problem getting the contents of the first column, but I can't seem to get the subitems over.

Example: I have this in the first listview:

Code:
|Item |Quanity|Price |PQ |
Bananas 2 $.50 $1.00

Then when I try to move that whole row to the other listview I can only seem to get this:

Code:
|Item |Quanity|Price |PQ |
Bananas

No subitems . Any links or help would be appreciated.

Regards,

Max_Power

How To Move A Listview
hi,
i need help in moving item from one listview to another listview.
e.g i have 2 form 'new customer form' and 'current customer form'.
inside the form i have a listview with header "first name", "last name", "city", "state" and "country", how can i check one row of the list from ' new customer form' and move it to another listview in 'current customer form'? pls help. tq

How To Move Rows In A Listview?
Is there an easier way of moving rows of data in a listview control?

right now this is what im doing:

(changed it)


Code:
x = Queue.SelectedItem.index - 1
Dim t(3) As String
t(0) = Queue.ListItems.Item(x).Text
t(1) = Queue.ListItems.Item(x).SubItems(1)
t(2) = Queue.ListItems.Item(x).SubItems(2)
t(3) = Queue.ListItems.Item(x).SubItems(3)

Queue.ListItems.Item(x).Text = Queue.SelectedItem
Queue.ListItems.Item(x).SubItems(1) = Queue.SelectedItem.SubItems(1)
Queue.ListItems.Item(x).SubItems(2) = Queue.SelectedItem.SubItems(2)
Queue.ListItems.Item(x).SubItems(3) = Queue.SelectedItem.SubItems(3)

Queue.ListItems.Item(x + 1).Text = t(0)
Queue.ListItems.Item(x + 1).SubItems(1) = t(1)
Queue.ListItems.Item(x + 1).SubItems(2) = t(2)
Queue.ListItems.Item(x + 1).SubItems(3) = t(3)

Queue.Refresh
Queue.ListItems.Item(x).Selected = True

basically what im doing is you have rows of data, and you can move each row up and down to where you want it .. . but it would be a lot of code if i had 20 subitems...

Move To Next Index In Listview
in listbox control....... it was easy just

list1.listindex = list1.listindex + 1

How shall i do the same in ListView Control ??

How To Move Highlight In The Listview
I have using listview, How I can move the highlight with fullrowselect in the listview to the first record and the last record.

Thank you.

Move Items In The Listview
I am refer the following thread below to move the items in the listview.

http://www.vbforums.com/showthread.p...items+listview

When there is not items in the listview, I click the button, I got the error message. and the error message point at
strCol1 = ListView1.SelectedItem

So How to solve it?


Code:
Dim itmX As ListItem
Dim strCol1 As String
Dim strCol2 As String
Dim lngIndex As Long
strCol1 = ListView1.SelectedItem
strCol2 = ListView1.SelectedItem.SubItems(1)
lngIndex = ListView1.SelectedItem.Index
ListView1.ListItems.Remove (lngIndex)
If lngIndex = ListView1.ListItems.Count + 1 Then
lngIndex = 0
End If
Set itmX = ListView1.ListItems.Add(lngIndex + 1, , strCol1)
itmX.SubItems(1) = strCol2

ListView1.ListItems(lngIndex + 1).selected = True

How To Move Highlight Up/down Listview?
Hi all i am using these 2 functions to increment and decrement lItemPos. I want in the mean time to highlight the corespondent listview row. For example if lItemPos is 2 then i want position 2 in listview get highlight .(Note: i have position zero too). I be happy if some show me how to move up and down the hightlight over row of my listview.Thanks


Note my listview is 4 column listview.


VB Code:
Public Sub increaseItemPos()MessageCrossProcess2 FindListView("Search Results") 'for deselect previouse item   lItemPos = lItemPos + 1   Form1.Text1.Text = lItemPosEnd Sub Public Sub decreaseItemPos()MessageCrossProcess2 FindListView("Search Results")   lItemPos = lItemPos - 1    'Text1.Text = lItemPos    Form1.Text1.Text = lItemPosEnd Sub

Move ListItem From 1 ListView To Another
Hi,


I'm using 2 buttons to control the movement of ListItems from 1 ListView to

another. I would like to know how it is done.


Private Sub cmdAdd_Click()



Dim itmListItem As ListItem

Dim temp1, temp2 As String



With ListView2

Set itmListItem = ListView1.SelectedItem.ListSubItems(0)

itmListItem = ListView1.SelectedItem.ListSubItems(1)

temp1 = itmListItem.SubItems(0)

temp2 = itmListItem.SubItems(1)



End With



MsgBox "temp1 = " & temp1 & " temp2 = " & temp2



End Sub


The error message is 'Index out of bounds'. What's wrong with the above code??

Get A Sub Item Of An Item On A ListView
Awhile go I used a Listview before on a project and I remember most of it. There is one thing I am having trouble with though. The list get's populated when the form is loaded. It has 2 headers "Item" and "Number". What I want to do, is when a button is pushed, msgbox the selected items number (In other words the sub item). How do I go about doing that?

How To Move Listitems Inside A Listview
Hi,

I have a typical scenario. I have a listview control and a up down controls. The listview is filled up using values inside a database. Now what I want is to move the listview items up and down according to up or down key pressed. Please help me.

Move Listview Items Up/down **RESOLVED**
I'm brand new to the listview and I can't seem to figure this out. I searched the forum and didn't see anything, so...
How do you set the index of an item in the listview? For example, a button the moves the selected item down one position.

ListView: Move Row Up/Down On Button Click
Is it possible to take a selected item/row in a listview and move it up/down in the listview based on a button click?

For example, in the listview if the rows were

The First Row
The Second Row (selected Item)
The third Row

Move up button click:
The Second Row
The First Row
The Third Row

OR

Move down button click:
The First Row
The Third Row
The Second Row

Any help would be greatly appreciated


Move Selected Listview Items Up/down/top/bottom
Hello, does anybody know how to move the selected items in a Listview up, down, to the top, to the bottom? Including subitems, keys, tags, etc.

How To Move Multiple Selected Items To New ListView
I have 2 ListView Controls. I need to move multiple selected items from ListView1 to ListView2.

How would I go about doing this?

How To Move Mouse Highlight Up And Down External Listview?
Hi all . I have an external list view and i wonder how i can make a vb program that has 2 buttons that allow the mouse highlight move up and down. I do not mean the item i just mean the mouse highlight. I be happy if an expert show me how.Thanks

Drag/Move Items In Listview Like In WinAmp
Hi,

How to make dragable/moveable items in Listview like in WinAmp?
I use viev mode: report (3)
My list have 10 collumns.

The example how to do it would be great ;]

Thanks

Move Items In Listview - Including Subitems
I needed to know how to move items in a listbox up and down. I searched on here and found the code below (Thanks!) but when I use it and move an item, it looses the subitems with it. It only moves the first column. Can someone show me what to do to move the remaining 3 columns each time? And also, what error trap can I put to prevent an error if no items are available to move or if the item it at the top already and I try to move it up?

Thanks alot!!!!

Private Sub ListView1_KeyDown(KeyCode As Integer, Shift As Integer)
x = ListView1.SelectedItem.Index
With ListView1.ListItems
Select Case KeyCode
Case vbKeyUp
.Add x - 1, , .Item(x)
.Remove x + 1
Set ListView1.SelectedItem = .Item(x)
Case vbKeyDown
.Add x + 2, , .Item(x)
.Remove x
Set ListView1.SelectedItem = .Item(x)
End Select
End With
End Sub

How To Get The First Item In A Listview
This should be fairly easy, but for some reason nothing I've tried seems to work. I'm trying to visually pull out certain criteria in a listview. I'm using the following code to change the forecolor of the items in the listview. I can change the subitems, but can't figure out how to change the first item in the row.
Code:
If Trim(Rs![F14]) = "D" Then
For Y = 1 To Lvw1.ColumnHeaders.Count - 1
itmX.ListSubItems(Y).ForeColor = vbBlue
Lvw1.Refresh
Next Y
End If
I thought this would be easy to do. I've tried

lvw1.ListItems(Y).Forecolor (changes the first item in every row)
lvw1.SelectedItem.Forecolor (always changes the first item in the first row)

This has got to be simple enough. Can anyone tell me what I'm missing?

ListView Add Item
Hi

No doubt a nice simple one for someone but I am trying to use the ListView to display a set of records.

Can somebody tell me how to add a value to the listview? I have a recordset and I asume I need to cycle through it adding each value to the listview - but how?

Cheers

ListView Item
When a row is selected in a listview is there a way to get the value which may be in column 3 of the selected row?

Get Item # For Listview
How do I get the number of the item that is selected in the listview?

Listview Add Item
I added a listview to my form and right clicked on it and properties > column headers > add column i typed in the text i did this for 3 columns then clicked apply and then ok and i had to columns . Is that how im suppous to add columns?

Listview Add Item
how do i add an item to the second, third, fourth, fifth, etc column of a listview?

Add Item To Listview
when i add data to listview, why then new data goes to the top line, not the bottom line? thanks

Copyright © 2005-08 www.BigResource.com, All rights reserved