###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
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Move Items In Listbox...
my problem is simple and stupid:
I have an app with an listbox in it. I want to give the ability to the user to move up or down the items of the listbox but I don't know how to do this. Any ideas?
--------------------------------------------------------------------------------
What's up maggots?? I hope u are Slayerized!!!
www.slipknot1.com www.slayer.net
Edited by - SledgeHammer_999 on 7/12/2005 12:44:46 PM
Listbox Move Items Up And Down
Hey-
how would I make it so when a listbox item is selected the user can press an "up" or "down" button to move the line, rightfully, up or down? NE help would be greatly appreciated.
How To Move Items Up/down Listbox?
Hi,
What is the simplest way to move an item up or down a list box with a command button? Be aware I keep getting an error when it reaches the top/bottom of the list if you keep clicking the command button.
Code:
Private Sub cmdUp_Click()
Dim strItem As String
Dim i As Integer
strItem = lstAllStars.Text
i = lstAllStars.ListIndex
lstAllStars.RemoveItem lstAllStars.ListIndex
lstAllStars.AddItem strItem, i - 1
End Sub
Thanks in advance!
Ed
Move Items In A Listbox
I need some help with a listbox control in VB. Can somebody tell me how to move items in a listbox up and down by clicking a button on a form.
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 Items Inside ListBox
G'day!
Does anybody know how I could move items inside a ListBox like Winamp does? I am making an MP3 player and this is for the playlist.
Thanks!
How To Move The Mouse Down A Listbox Items?
Hi all. There is an application that has a listbox and once u click in one of item of the listbox the item get highlighted and once u double click on it a new window gets open. I do not have access to application source code. What i want is to develop a form with button and once i click on start and i place the mouse over topest item the mouse crawl down the listbox items one by one and duble click on each itme untill i reach the end of list itmes. I do not know the exact search term for it.so i be happy if an expert tell me how i can achive that task.
Easily Move Items From One Listbox To Another
Using this one sub routine, you can easily move one or more than one, or all items, from one listbox to another. This code uses 4 command buttons with the following captions:
>> - move all items from listbox on left to listbox on right
> - move selected items from listbox on left to listbox on right
< - move selected items from listbox on right to listbox on left
<< - move all items from listbox on right to listbox on left.
VB Code:
Private Sub MoveLBItems(FromListBox As ListBox, ToListBox As ListBox, Optional MoveAll As Boolean) Dim i As Long With FromListBox If MoveAll = True Then For i = 0 To .ListCount - 1 ToListBox.AddItem .List(i) 'move all items to Tobox Next .Clear Else For i = .ListCount - 1 To 0 Step -1 If .Selected(i) = True Then ' if selected then ToListBox.AddItem .List(i) ' add to other list .RemoveItem i ' remove End If Next End If End WithEnd Sub Private Sub cmdMoveAll_Click()MoveLBItems List1, List2, TrueEnd Sub Private Sub cmdMoveSelected_Click()MoveLBItems List1, List2End Sub Private Sub cmdMoveSelectedBack_Click()MoveLBItems List2, List1End Sub Private Sub cmdMoveAllBack_Click()MoveLBItems List2, List1, TrueEnd Sub 'to use this project wide, simply move the sub to a module and make it Public
How Do I Move Items In A Listbox Control
Hi,
How do i move a
1.selected item in a listbox from its current position and insert it a position above.
2. selected item in a listbox from its current position and insert it a position below.
Please do help me.
Regards
M.C.Chengappa
Swap/Move Items In A Listbox
How can I move items in a listbox?
Let's say I have one listbox, where its style property is set to checkboxes. How can I move items whose checkboxes are checked? I should be able to move them up and down by pressing up or down button.
For example a listbox contains 10 items, and item 5, 7 and 3 are checked. When I press down button it should move those items down by one.
Please help.
Thanx.
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 Items In Listbox (using RowSource From Worksheet)
I have a listbox which has been populated by dropdown lists in a multipage user form. The data has been copied to worksheet manipilated by user and then returned to list box by rowsource from worksheet range. Have no problem deleting rows from list box but have become unstuck on the issue of moving data in list box which refects on the worksheet. The final procedure from this form is to print the data.
Select ListBox Items With Mouse Move
Say I have a listbox with the following items
VB Code:
Private Sub Form_Load()With List1 .AddItem "Oranges" .AddItem "Grapes" .AddItem "Pears" .AddItem "Prunes"End WithEnd Sub
I would like to be able to display the item my mouse is over in a tooltip, but
VB Code:
Private Sub List1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)List1.ToolTipText = List1.List(List1.ListIndex)End Sub
Doesn't seem to work.
How could I do that?
Move Checked Items To Top Of Listbox. (Resolved)
Hey All,
Let's say I have a listbox (style = 1 - checkbox) with the
following code...
Code:
Private Sub Form_Load()
List1.AddItem "apple", (0)
List1.AddItem "orange", (1)
List1.AddItem "banana", (2)
List1.AddItem "grape", (3)
List1.AddItem "lime", (4)
List1.AddItem "lemon", (5)
End Sub
Now, let's say I select (check) three of the items in the listbox.
Can someone please tell me how I can move those three items
to the top of the list, when I click a button.
I kind of figured that I will need to loop through the list, but I
can't seem to get anything to work.
Thanks in advance for any help,
Ron
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?
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
Move Items From Listbox To Listbox
I have a form that contains 2 listboxes. When the form loads the first list box appears the users enter the information in to a text box and on enter that information is placed in the list. Below the list I have a command button the command buttons needs to be able to get the information from list one and be viewed in list 2. Here is the catcher though after the user enters the information the user will need to go back and select the ones needed to be moved. I have set the multiselect to true so that works but I need the ones selected to be moved to listbox2 on click.
Thaks in advance for any help you can provide.
ListBox - Move List Item To Place In List
I have a list box with several items. I am trying to make a button that when the user selects an item in the list box, they can click on the button which will move the item up one in the list box:
So if my list looked like this:
ONE
TWO
THREE
FOUR
FIVE
and the user selected FOUR and clicked the button the list would look like this:
ONE
TWO
FOUR
THREE
FIVE
Does anyone know how to do this?
Thanks,
M
VBA Listbox Move Up And Move Down
The following code will provide move up and move down functionality for a VBA ListBox. This works for all potential modes of list box selecting:
1) single select
2) Multi select (using the ctrl key)
3) Extended select (using the shift key)
Basically, it will take the selected item and move it up or move it down. So blocks of selected items will move succesfully, multiple selected items, etc.
I do not take full credit for writing this...Herilane also assisted. It was a tag team effort.
Code:
Private Sub cmd_Up_Click()
Dim i As Long
Dim leaveAlone As Boolean
Dim pos As Long
Dim Temp As String
pos = 0
For i = 0 To ListBox1.ListCount - 1
leaveAlone = False
If ListBox1.Selected(i) Then
If i = pos Then
leaveAlone = True
End If
pos = pos + 1
If leaveAlone = False Then
Temp = ListBox1.List(i - 1)
ListBox1.List(i - 1) = ListBox1.List(i)
ListBox1.List(i) = Temp
ListBox1.ListIndex = i - 1
ListBox1.Selected(i) = False
ListBox1.Selected(i - 1) = True
End If
End If
Next
End Sub
Code:
Private Sub cmd_Down_Click()
Dim i As Integer
Dim leaveAlone As Boolean
Dim pos As Long
Dim Temp As String
pos = ListBox1.ListCount - 1
For i = ListBox1.ListCount - 1 To 0 Step -1
leaveAlone = False
If ListBox1.Selected(i) Then
If i = pos Then
leaveAlone = True
End If
pos = pos - 1
If Not leaveAlone Then
Temp = ListBox1.List(i + 1)
ListBox1.List(i + 1) = ListBox1.List(i)
ListBox1.List(i) = Temp
ListBox1.ListIndex = i + 1
ListBox1.Selected(i) = False
ListBox1.Selected(i + 1) = True
End If
End If
Next
End Sub
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 Items From One Folder To Another
How do I go deleting a message in my inbox, and have it show up in my Trash? I know this much of the process:
1. Delete the message (Don't need info on this)
2. Empty the listview when the user clicks on the Trash folder (Don't need info on this either)
There's a Step C, which involves retrieving the sender, subject, send date, and message text from the message, just like I did when retrieving new mail. How would I retrieve the data for just that message, and add that to the now-empty listview?
An example of what I want to do would be found inside Outlook Express. Note as it empties the listview when you change folders, and then loads the contents of the selected folder.
Sorry if this seems a little vague, but that's the best I can explain it.
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?
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
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
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!
Split + Move Combo Box Items
I am working on a program that logs into aim on multiple accounts.
It has a combo box were the account:password is loaded, in a line by line form like:
Account:Password
Account:Password
Account:Password
And so on... I need to make it so that it basically press's down to bring the next account:password into the main field, making it readable, then log into aim with it, using tocsock.
Code:
Private Sub tocSock1_incomingChatID(Index As Integer, strRoom As String, lngId As Long)
Dim a As Integer
Dim sn(Slider1.Value) As String
Dim pw(Silder1.Value) As String
For a = 1 To Slider1.Value
tocsock1(a).loginUser sn(a) pw(a)
Next a
End Sub
That is the code so far. sn will be replaced with the correct control name.property of the split, being the text before :
pw will be replaced with the second part of the split.
I believe my code is correct, I just have to make it perform a split, and after each attempt, move the combo box to the NEXT account, following the one it was just on. It should start socket 1 with the 1st one in the slot, not with the blank part, which would be the (0) of the combobox.
Thanks alot in advance, I hope I explained it enough!
EDIT: The Slider control is what selects how many sockets will be used, which is what "a" is. Thanks!
Move Items Back And Forth Between Listviews
I have populated a listview with two columns of information, one a chemical name and the other an associated code. I want to select one or more names and move them and the code to a second listview, removing them from the first. I also want to be able to remove selected item(s) from the second and pass them back to the first. I have done this with listboxes, but how is this done with listviews. I am stumbling all over I need the codes from the second listview to pass to a SQL query rather than long convoluted chemical names (that have embedded commas as well).
Move Items In 2 List Boxes
I need a code that when the user either clicks up or down items in 2 listboxes will move.
Let me explain... when the user clicks the second of the first list box then clicks the up cmdUp button the second item of the second listbox will also move up. Any suggestions?
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 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
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
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
|