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




Listview Item Moving


Hi there,

is it possible to move items in a Listview control(Up and down the list) and how, this one is baffling me

the pig...




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
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

Moving The Selected Item In Listview
****
I solved the problem, thanks to all for your attempt at helping.

Here is the code:

Set ListView.SelectedItem = ListView.ListItems(i)
****

I have a Listview populating from a database and sorts the data alphabetically.

Now when the user deletes an item from the database, it also refreshes the listview.

The question I have is, the listview always sets focus to the last item it added, however it does not add them alphabetically, so after there added and the listveiw sorts them, the item selected could be anywhere!? How can I have this list view set focus to the first entry? Or better yet one that I specify or has been saved (IE save the record ID when they exit the prog, so when they come back I can pull that and set focus to that item)??

Thanks for the help.
Bryan

[This message has been edited by Bryan (edited 01-12-2000).]

Stop Item Dragging/moving In ListView
Is there any way you can stop the user from moving the item position in a listview?? I need them to stay the same as i added them first by code, with them being fixed for the user and not allowing any movement of item position!

thanks!

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.

Moving To The Next Item In A Pivotfield
I have some code which runs in this For loop.


Code:
For Each PivotItem In ActiveSheet.PivotTables("PivotTable1").PivotFields("Questions").PivotItems
Sheets("Pivot Table").Select
Range("A4").Select
Range(Selection, Selection.End(xlToRight)).Select
Selection.Copy
Sheets("Chart Data").Select
ActiveCell.Select
ActiveSheet.Paste
Sheets("Pivot Table").Select
Selection.End(xlDown).Select
Range(Selection, Selection.End(xlToRight)).Select
Selection.Copy
Sheets("Chart Data").Select
ActiveCell.Offset(1, 0).Select
ActiveSheet.Paste
ActiveCell.Offset(3, 0).Select

Next

The item "Questions" is in the page field at the top.

I'd like the code to move to the next item in the page field, and perform the code.

Any idea how it's done?

Moving Item From One Listbox To Another
Hey all

I am trying to move an item from one listbox to another. The first listbox has items where the RowSourceType = "Field List" and the second one is value list. This is my code:

Private Sub DisplayAllFields_DblClick(Cancel As Integer)

If ListOfFieldsSelected.RowSource = (List0.Value & "." & DisplayAllFields.Value) Then
MsgBox ("You cannot select a field more than once. Please select another field")
Else
ListOfFieldsSelected.AddItem (List0.Value & "." & DisplayAllFields.Value)
End If
End Sub

When I double click the same value in the first list again, it brings up the msgbox once but it doesn't do that once it has added another field to ListOfFieldsSelected. I would use the RemoveItem method so user can't click the field again but DisplayAllFields is set to Field List so it can't remove item unless set to "Value list". Any suggestions on this?

Any help will be greatly appreciated.

Many thanks

Rupa

ListBox, Moving From First Item To Second And So On
Hey, im working on a media player, the media player works great but the playlist is screwey! Im having troubble with this:

You select an item for play - 100% ok
it plays it - 100% ok
it then goes to the next item on the list - BUGGY!

it wont move to the next item and when it does, it wont update the selected item eg, it will play the next item then when thats done it will play the one before that not the next on (constant loop between two files). Please help

Moving A Item In A List Box Up Or Down
I have two buttons on a form and I want the be able to click the up button then move the selected item up or click the down button and have the item go down.

Any Ideas?

Moving Item Between List Boxes
I have a command button with the Caption ">". When clicked I want the selection the user has made in ListBox1 to be moved to ListBox2.

Anyone ever do something like this before?

thx..

When Moving Item Down In The Listbox The Text Disappears
Okay dont know why but the text is dissapearing when an item is moved down the list box.

Image1 displays before the move down
Image2 displays after the move down
Code is also attached. I am very confused I have been through this code througherly and I am sure there is not an error in the code.




Code:
' check: only proceed if there is a selected item
' check: last item can't be moved down
' save items text and items indexvalue
' remove item
' place item back on new position
' if you keep that item selected
' you can keep moving it by pressing cmdDown
' for arLoopCount adds the new playlist entrys from
' lstPlayList.
' list1 refreshes
' lstPlayList refreshes
Dim tempStr As String
Dim iIndex As Integer
Dim arLoopCount As Integer
List1.Clear ' Debugging orriented object to display the contents of arFilePlayList Array
If lstPlayList.SelCount = 1 Then
If lstPlayList.ListCount - 1 = lstPlayList.ListIndex Then
Exit Sub
Else
tempStr = lstPlayList.List(List1.ListIndex)
iIndex = lstPlayList.ListIndex
lstPlayList.RemoveItem lstPlayList.ListIndex
lstPlayList.AddItem tempStr, iIndex + 1
lstPlayList.Selected(iIndex + 1) = True
End If
End If
For arLoopCount = 0 To lstPlayList.ListCount
arFilePlayList(arLoopCount) = lstPlayList.List(arLoopCount)
List1.AddItem arFilePlayList(arLoopCount)
Next arLoopCount
List1.Refresh
lstPlayList.Refresh

Simple! Moving A Listbox Item For One Lsitbox To Another.
How can I move an item from

lstbox 1 ---> lstbox 2

I want the item to be removed from lstbox 1 and added to lstbox 2

Thanks for anyone who helps.

Questions: BitBit Moving, Walkmasks And Item Pickups.
Ok, so far have i quickly created a small program where a picture(the guy you control) moves instantly to the location of your click. Theres 3 things i must now:
1. How can i make my guy move slowly to the targeted location? not instantly.

2.How can i create walkmasks? Forexample if i create a tree, and i dont want my guy to walk right through the tree but around it.

3.How can i make my character pick up items? Forexample how can i make my guy get 10 score-points when he moves over an item, which in reality is a picture.

Edit*
I use BitBit.
This is not going to be a real game, iam just testing things out before i start creating a game.
Nothing is animated.

Moving Through A Listview
Hi!

Does anyone have any idea for coding, to move through a listview (it's in Report Mode). I essentially need to know the statments for:

a) set listview to the 1st item (anything like ListView1.BOF?)
b) move to next listitem
c) do until Listview is at the end (anything like ListView1.EOF?

Any Ideas?

I'm trying to loop through a listview, to check for values. So I'll need to set the listview to select the first item, and then DO UNTIL it's at the last item.

Thanks everyone!

-Matthew-
www.comperfection.com

Moving In A Listview
a) I pass the number of item in a listview to a variable
irecordcount = ListView4.ListItems.Count

b) I (i suppose) set the view to the first item
ListView4.ListItems(ListView4.SelectedItem.Index + 0).Selected = True 'Posicionar en el registro 0
c) In that position a call a routine to save the data
Call DetalleSuscripcionDireccion(txtsuscripcion, Me)
d) the i move to the next item in the view
ListView4.ListItems(ListView4.SelectedItem.Index + 1).Selected = True ' Avanzar

i do a loop from 1 to the number of item in the view.

WHY it is not moving?
What i am doing wrong?

Moving On A Listview
How can i move to the next record on a listview automatic?
I mean read the whole listview from record one to n

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?

Moving Through Items In A Listview
Am I being a complete , or what? I'm trying to move through the items in a listview, so that I can insert the entries one-by-one in to DB - ie each item in the listview represents a new record in a DB table.

Now, I would have expected (as with all things VB) this to be quite straight forward. Something along the lines:

ListView1.selecteditem.movenext

I know this a bit hopeful, but I can't believe there's no way to incrementally move through all the items.

I've been through MSDN and searched this entire forum for a similar thing but I cant find anything.

I must be missing something really obvious here!

Moving Things From One Listview To Another
Hey guys I have one listview called report on a form call antivirus. This listview has checkboxes.

I have another listview with no check boxes on a form call resuls.

What I would like to do is when an item or items is checked, whatever is in the first column of the report listview on the antivirus form goes in the results listview on the resuls form. The same as the second column, I would like that repeated as well.

But the twist is if the user checks a problem and then presses the delete button. I would like the 3rd column of the results listview on the resuls form to say "Deleted" for that checked item.

OR if the user checks a problem and presses ignore then it would just say Ignored by the item in the 3rd column.


Can anyone tell me how I could do all that?

Thanks!

Listview, Moving Columns?
Well, i cant really explain the title in just a few words. I want to add 2 more rows to my listview, but i dont want to add them at design time (alot of code to change then).

The problem is, that i want the two rows that i add, i want to move them so they are positioned in-between two columns that are already there.
So, i added rows 12,13 to my listview during design time. I want 12 and 13 to appear to be inbetween columns 1,2.

Hope it makes sense

Listview - Moving A Selected Row Up Or Down
Hi,

I want to allow the user to order items in a listview according to their choice. So I need to move a selected row in a listview up or down (by pressing up or down command button). How can this effect be acheived ?

TIA

mecracked

Moving Items In A ListView
Hi,
I'm using a ListView to show information. I want the user to be able to click and drag one of the ListView items to move it higher or lower on the ListView. Is there any way to do this? I know that you can do it with command buttons, but is there a way to do it with the mouse?

Thanks!

Disable Moving Of Image In Listview???
I use ListView in Microsoft Windows Common Controls 6.0 (SP6). I can add image to fill background but when i scroll-down, the image is moved!

I want image not to move. How i have to do?

pls help!

Thanks

Moving Things From A Listview To A Textbox?
Hey guys I have a listview called report and it has check boxes. I have another form called form2 with a text2.text.

Is there a way when I check one item and press a button that checked item goes in the text2 of the form2?

Its just the item from the first column of the report listivew.

Thanks!

Moving Multiple Listview Items Up Or Down At Once
Hi, does anybody know how to move multiple selected listview items up or down at once?

I found the subs below, but they only move one item up or down, even if I have selected multiple items.

Thanks.


vb Code:
Private Enum menmDirections    MoveUp = 1    MoveDown = 2End Enum Private Sub MoveItem(ByVal penmDirection As menmDirections)Dim lvwItem     As ListItemDim lvwNew      As ListItemDim lvwSubItem  As ListSubItemDim lngIndex    As Long    Set lvwItem = lstView.SelectedItem    If Not (lvwItem Is Nothing) Then        If penmDirection = MoveUp Then            lngIndex = lvwItem.Index + 2        ElseIf penmDirection = MoveDown Then            lngIndex = lvwItem.Index - 1        End If        If lngIndex > 0 And lngIndex <= lstView.ListItems.Count + 1 Then            Set lvwNew = lstView.ListItems.Add(lngIndex, , lvwItem.Text)            For Each lvwSubItem In lvwItem.ListSubItems                lvwNew.ListSubItems.Add , lvwSubItem.Key, lvwSubItem.Text, lvwSubItem.ReportIcon, lvwSubItem.ToolTipText            Next lvwSubItem            lvwNew.Selected = True            Set lvwNew = Nothing            lstView.ListItems.Remove lvwItem.Index        End If        Set lvwItem = Nothing    End IfEnd Sub



vb Code:
Private Sub MoveUp(lv As ListView)    Dim itm As ListItem, itmNew As ListItem, i As Long    If lv.SelectedItem.Index > 1 Then        Set itm = lv.SelectedItem        Set itmNew = lv.ListItems.Add(itm.Index - 1, , itm.Text, itm.Icon, itm.SmallIcon)        For i = 1 To itm.ListSubItems.Count            With itm.ListSubItems(i)                Call itmNew.ListSubItems.Add(, .Key, .Text, .ReportIcon, .ToolTipText)            End With        Next        lv.ListItems.Remove itm.Index        itmNew.Selected = True        lv.SetFocus    End IfEnd Sub Private Sub MoveDown(lv As ListView)    Dim itm As ListItem, itmNew As ListItem, i As Long    If lv.SelectedItem.Index < lv.ListItems.Count Then        Set itm = lv.SelectedItem        Set itmNew = lv.ListItems.Add(itm.Index + 2, , itm.Text, itm.Icon, itm.SmallIcon)        For i = 1 To itm.ListSubItems.Count            With itm.ListSubItems(i)                Call itmNew.ListSubItems.Add(, .Key, .Text, .ReportIcon, .ToolTipText)            End With        Next        lv.ListItems.Remove itm.Index        itmNew.Selected = True        lv.SetFocus    End IfEnd Sub

LISTVIEW(stoping Icons From Moving..)
i have been seaching for a way to disable moving of icons in a listview.. and i haven't found anything yet. I see it possible in other programs.. but how is it done??? that i don't know. So i am asking you all if there is a way.. a non API approach would be much better.

Listview Report Moving Items Up &amp; Down
Hi everyone ,

I know how to move the first column field up and down in a listview report.

But now i have 10 columns and the user wants to select a row and puts it one down (if its not already at the bottom) or one up (if its not already at the top).

thx

ListView - Stop Icons Moving
Hi,
I'm using a listview control in the Icon mode, to display a control panel for my application. The only problem is that when a user clicks an icon, when you move the mouse it moves the icon as well.

Is there any way to stop the user moving the icon?

Moving ListView Column Headers
Is there a way that the user can move the Column headers of a list view control. Additionally a way to select the whole line rather than the first column.

Thanks.

Moving Columns On A Listview (Report View)
I want to programmatically set the Position of the columns in a list view.

This is an "after thought" so I am trying to do it on already loaded listviews.


I see from a little experimentation that I can easily move the column headers by simply changing the .position property.

But that does not bring over the data for that column. (Just the header)

Do I have to manually move the data or there an easier way?


(By "manually move the data" I mean set up a temp array, copy the column's data, update new column after moving other column into original col number)


Regards,

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

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

Add Item In Listview
How do I add a item in listview with data in different columns??

please!!

Item In A Listview
I want to get an specific item in a listview. I mean: I have several information displayed on a listview. If the User click on the listview on item X, i want to get the value of column Y.

Set A ListView Item By Key?
VB Code:
lvItem.SubItems(1) = "Text"


The above sets a ListView list sub item by index, but can I code the above to work by the .Key property somehow?


VB Code:
lvItem.SubItems("KeyName") = "Text"


Doesn't work...

I just realised that the 1st version is a pain if I reorder the columns in the listview. So, I'd like to access it by key, if I can, but it doesn't seem to provide that interface...

1st Item In ListView
Can anybody tell me the code to select the 1st item in a listview control?

I've tried the GetFirstVisible method, but it doesnt always select the top most item...

cheers.

Get Listview's Item Value
when clicking on the item of a listview, i hope to get the value of the item and the following subitem. how to do that??

Going To Next Item In Listview.....
Hey, I was wondering how you can go to the next item in a listview. It's easy in listbox, but I tried

listview1.listindex +1, etc. and it doesn't work

Thanks for any tips.

Going To Next Item In Listview.....
Hey, I was wondering how you can go to the next item in a listview. It's easy in listbox, but I tried

listview1.listindex +1, etc. and it doesn't work

Thanks for any tips.

Getting The Item In A Listview
I have three columnheaders in my listview. I am adding the hwnds of every window with the code in the first column. Here is the description

columnheader1 - > hwnds of the windows
columnheader1 -> Classname of the windows
columnheader1 -> Titlebar text of the windows

When I have about 3 rows in my listview (3 hwnds), I want to show the window(containing that hwnd) in a loop. I am using this little code but it shows me an error message saying "index out of bound":


Code:
Private Sub showall_Click()
Dim i, a As Integer

i = ListView1.ListItems.Count
For a = 1 To i
Call ShowWindow(ListView1.ListItems(a).Text, SW_SHOW)
ListView1.ListItems.Remove (a)
Next
End Sub



Do you know what is rong with that?

How To Add Item To Listview??
I manage to add in item into the first colum but failed to add to the second column. Here is my code

With de.rsContacts
    Do While Not .EOF
    Set Contact = Me.ListView1.ListItems.Add(1, , !FirstName)
    Me.ListView1.SelectedItem = lvItem.ListSubItems.Add(2, , !MiddleName) '2nd column
    Me.ListView1.SelectedItem = lvItem.ListSubItems.Add(3, , !LastName) '3rd column
    .MoveNext
Loop
.Close
End With

I have an error message for the 2nd and 3rd column. Can anyone tell me how to solve
??

Listview Item
hi,

i want to show a selected item at the top of the Listview control while in report view .

or
make other items visible =false or height=0

do you know how?

Thanks
Orko

Add An Item In A Listview
Hi!

In one of my form i have some textBoxes. The user enter the data that he want and when he press save button i would like that the data in each of the textBoxes will be put after the last record alreaydy in the listview. But we never know exactly how records the user has in his listview.

How can i add a record automaticly at the end of the listview without knowing the exact value of the index? Is it possible to have something like a dynamic index?

Thanks a lot

Listview Get Currently Selected Item
Is there a way to get the currently selecteditems text for a listview. I'm using vb 2005 and I don't see how to get a listview currently selecteditem. Someone please help me

Thanks for any help
Chris Ara

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