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?
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
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..
ComboBox List/add Item, If Item Exists, Dont Add It Again!
Dudes and Dudeesses I need help!
I have a problem with a combobox within a form. I'm scanning down the spreadsheet for values and asking a combobox to .additem, however, the same value may appear twice whilst scanning down. Is there an if statement that will look and check the combobox to see if it is already added, if so dont add it again, if not, add it?
as below,
Code:
combobox.AddItem "Hotmail"
combobox.AddItem "Yahoo"
combobox.AddItem "Hotmail"
Hotmail will be added twice, how can I stop that?
If worst comes to the worst, I can sort it out with a long winded method, but I'm hoping theres a quicker way.
Thanks for all your help
Single Item List Box (item Not Really Selecting)
Application=Access2002
The following code has worked for me in the past but won't now for some reason.
I have a private function and/or subs that performs a few simple operations such as setting listbox rowsources and simple math functions on a form. The queries set as rowsource use criteria from other single item listboxes.
Now, for some reason, the queries won't return values until the previously .selected(0) = true (single item) list boxes have been clicked on.
Problem has only been in creating a new form. Perhaps the problem did not occur in older created forms due to compatibility?
Private Sub fraEWTo_AfterUpdate()
[Edited]
lstRotorHoursPriorTo.RowSource = "qryRotorSwapHoursTotTo" 'gets hoursprior from tblRotors
lstRotorHoursPriorTo.Selected(0) = True ' This is one place where the problem seems to exist, the control does not function until it has been clicked on via mouse.
LstClockInTo.RowSource = "qryRotorSwapRAHoursIPTo"
LstClockInTo.Selected(0) = True
txtRACHIPTo.Locked = False
txtRACHIPTo.Value = txtClockHoursTo.Value - lstClockInTo.Value 'nor will this until the lstClockInTo box has been manually selected
A Mechanic in a Programmers shoes
Thanks
Edited by - greenfch on 12/7/2005 11:22:52 AM
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?
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...
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
Finding List Item As U Typed In Combo Box(Dropdown List Style).
Basically the title say it all.
When I type a letter in combo box it finds item by matching the letter that I typed, but when I type in a second letter it searchs item that starts with the second letter.
I wonder is there a way to macthing list item as u typed in combo box(Dropdown List style).
Thanks in advance.
Joon
Create List Of Files From Folder But Allow Double Click On List Item To Run Bat
I am a newbie
But am making some progress
My next plan is to make a simple dialog with a list box and 3 buttons to do the following
List all the batch files in a folder
then allow me to highlight one item in the list so when I click the button it will run that bat file.
Sounds easy enough but I just keep hitting a brick wall and am not making any progress at all.
All help or similar snipits of code that I can re-organise will be greatfully apperciated.
Thanks in advance
HighLight List Box Selected List Item With User Defined Color
Hi Friends,
I need a help from u all. My problem is to change the Backcolor of the selected listitem of a listbox.
Let me explain detail. Normally in a listbox if we selected the list, the list item will be highlited with blue backgroud (ie. the selected item color settings of the system). Now I need to hightlight the selected list in the list box with my own color say red, green or something else.
Would anyone help me.
V.P. Vijayavel
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).]
List Box Item Scrolling (Next Item)
Hello,
I was wondering what the code would be for a command button to make the next item in the list box be selected?
Kind of like a NEXT button.
EXAMPLE:
List box Line 1
List box Line 2
List box Line 3
List box Line 4
If List box Line 2 is selected then clicking the next button would DESELECT List box Line 2 and SELECT List box Line 3.
If I didn't explain enough just let me know.
Stilekid007
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
Combine List Items To Create New Item In Same List?
Hi all,
This has been giving me fits for a few days - any help would be most appreciated. I'm sure it's pretty simple, but I'm new to VB (and programming in general) and can't seem to come up with the correct syntax to get this to work:
I have a listbox from which the user can select mutliple items. Once user performs a multi-select, I enable a button (no problem there). When user clicks that button, I want to create a new item in that same list consisting of all selected items with "AND" between them.
Thus, if user had selected <item 1>, <item 2>, and <item 4>, the new item would be "<item 1> AND <item 2> AND <item 4>". Can someone please help me with the logic and syntax on this?
Here's what I have up to this point (I've removed the parts that I believe - based on the fact that this is not working - to be wrong and replaced them with ?????):
Code:
Dim terms As String
For Each terms In List.SelectedItems
If List.SelectedItems.Count > 1 Then
terms = ??????? & " AND " & ???????
End If
Next
List.Items.Add (???????)
Thanks!!
Edited by - troy_atl on 10/17/2005 12:04:26 PM
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!
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
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.
Add A List Item To A Loaded Form List
help please. this is probably very simple.
i have a form loaded and showing. i need to add items to a list box, and my code is in a public sub in a different module.
my code follows. i wind up getting an "object doesn't support this type of property..."
i feel like i am close, i just don't seem to be referencing the form list correctly.
thanks much!
Public Sub BuildOverviewList()
Dim dbSOURCE As Database
Dim dbTARGET As Database
Dim rsSOURCE As Recordset
Dim rsTARGET As Recordset
Dim strDatabase As String
Dim strTable As String
strDatabaseName = "ProductCategories.mdb"
strTableName = "tblCurrentPresentation"
Set dbTARGET = OpenDatabase(dbPath & strDatabaseName)
Set rsTARGET = dbTARGET.OpenRecordset(strTableName, dbOpenDynaset)
'aryProductGroup provides the selected categories
For i = 1 To UBound(aryProductGroup)
'aryCategory1
For j = 1 To UBound(aryCategory1)
If aryCategory1(j) = -1 Then
strDatabaseName = "Category1_information.mdb"
strTableName = "CategorySlides"
Set dbSOURCE = OpenDatabase(dbPath & strDatabaseName)
Set rsSOURCE = dbSOURCE.OpenRecordset(strTableName, dbOpenSnapshot)
'write the record to the target table and add to list1
'USE THE ARRAY POSITION (j) TO GET THE SLIDE NAME FROM THE CORRECT TABLE
'ADD THAT SLIDE NAME TO THE LIST.
With rsSOURCE
rsSOURCE.Move (j)
With rsTARGET
.AddNew
![StepID] = 4
![CategoryID] = aryProductGroup(i)
![ProductID] = j
![Name] = rsSOURCE.Fields("SlideName").Value
.Update
End With
'Forms.frmPresOview6.List1.AddItem rsSOURCE.Fields("SlideName").Value
Forms.frmPresOview6.List1.AddItem rsSOURCE.Fields("SlideName").Value
End With
'also add record to ProductCategories/tblCurrentPresentation
End If
Next j
Next i
Moving Mouse Over The List Box
Hi, I am trying to manually make my own Menu Editor. I don't like how you cannot edit the font and color of the regular menu editor.I got it all working and looking great, but there are 2 small problems that I cannot figure out how to fix.
I want to be able to move the mouse over a list box, and just like a regular menu I want the one that is under the mouse to be highlighted. And as you move the mouse over different selections it will highlight them, without yet clicking on the mouse, anyone know how to do that?
Also, does anyone know how to change the forecolor of a command button? It is possible?
I appreciate any help.
Thanks,
Dan
Moving Items To The End Of The List!
hi!all!
i am looking for a code to move a selected item to the end of the list box!
for example i have a list1 with items
1
2
3
i select the first item ,item 1 and then click the button!
the item should move to the end of the list and the list would look like>
2
3
1
---------------------------
Moving Items Up And Down In A List Box...
Hey guys, I was wondering if anyone can help me on how to move items up and down a list box? Also, if I want to move an item start from the bottom to the top?
Please, help me...
Moving Items Around A List Box
hi !
I have yet another short query here..and would be grateful if anyone could help.
I got a list box with a playlist for a radio show..and to the right of it i have 2 more listboxes..one with duration of track and the other with the point in time at which the track starts in the show.
I have 2 buttons below up and down which when clicked on move the selected item up or down in the playlist accordingly along with the related times.
How do i do this ?
Also how do make sure that there is one item selected at aLL times.
any help would be great !
Harpooon
Moving Up && Down In File List Box
heyy guyz..
i was wondering...if i have a file list box with many files in it...how can i cause the cursor or watever to move to the next file down or up, to the beginning, and to the end of the list of files (and if possible cause the cursor to move randomly as well)...
and if it does move...under which event would that be?? example: file1_change??
thanxx in advance
Moving Lines Within A List Box
hello,
i have a list box and i want to move some lines in it, but here is the catch;
i built the list like this:
i have a 'brake' line and then some other lines starting with " " (4 spaces). it serves me as groups.
what i want to do is move the entire groups up and down.
i keep failing on managing to do this..
it looks something like this:
brake1
line1
line2
line3
brake2
line1
brake3
line1
line2
i have between 2 and 10 brakes and as many lines between them.. (they also have unique names; not 'brake' and 'line').
also,
the up and down buttons are only enabled when i'm on a brake.
they are disabled seperatly when i'm on the first or last brake.
when i click on my up button (for example when i'm on brake3);
it will replace brake2 and look like this:
brake1
line1
line2
line3
brake3
line1
line2
brake2
line1
and so is with the down button (on brake1);
brake3
line1
line2
brake1
line1
line2
line3
brake2
line1
after this, i also want to be able to move the lines up and down, but to disable the buttons when i'm on the first line and the last line.
(i only use 2 buttons; 'CmdUp' and 'CmdDown')
i use this line to tell when it's a line and not a brake;
if left$(list1.listindex,4)=" " then blahblah..
i only managed to get the brake (any) to become the first of the list, and not even go down...
help?
thanks in advance..
Moving All Items From One List Box To Another
I am having problems selecting the first item in the list box. Here is the code that I have written:
Private Sub ZonesAll_Click()
Dim ZoneName As String
Dim ZoneNumber As Integer
Dim n As Integer
Dim i As Integer
n = Me.ZonesNotSelected.ListCount
'I need a line here that will select the top item in the list
For i = 0 To n - 1
Me.ZonesNotSelected.Selected
ZoneName = Me.ZonesNotSelected.Text
ZoneNumber = Me.ZonesNotSelected.ListIndex
Me.ZonesNotSelected.RemoveItem ZoneNumber
Me.ZonesSelected.AddItem ZoneName
Next i
End Sub
Thanks
SLR
Moving List Items Up And Down
This is a bit foolish question bu I forgot how to do it.
I want to move items listed in the list box up or down. How do I do it?
Kinjal
Moving Items Up/Down In List Box W/VB
There is another thread in the javascript section with almost the same title, so what I am wondering is if there is a VB version of it. The thread id is
URL
Any help would be greatly appreciated
Moving List (TreeView VB6)
Hey,
I have a list, and I was wondering if there was a way to move an item e.g. from 3 > 4 or 4 < 3 by clicking on a command button? Also if you can drag and drop them to the position that you want them to be in?
Thank You
AddItem To Combo List And Have The Combo List Be Able To Retain The Item Upon Recall
I have a project that I need to do for school. You are to have a command button, a combo/dropdown list and a text box, you are to enter a name and birthday in the text box and when you click on the command button it is supposed to enter it in the combo box. My problem is that I got it to enter into the combo box with additem, but it will not retain the item that I just added. When I close the program the item I added does not stay there. How do I get the combobox to retain everything that I add through the textbox on command click. PLEASE HELP
Moving Through The Files In A File List Box...
Hey everyone,
As the title states I am trying to move through files in a file list box. For example...if the file list box contains 3 files and the user selects all 3 and clicks on a delete button, a loop will be activated like below that will update the selected index and call the delete confirmation each time. The problem is I don't know how to get the selected index to change. I have tried filelistbox1.selectedindex.equals(count) but the selected index never changes from 0. If this isn't clear post back and I'll try to explain it better...any help would be greatly appreciated. Thanks in advance
Code:Dim count As Integer = 0
Do Until count = FileListBox1.SelectedItems.Count
'update selected index so when frmdelete is called it uses the right filename
frmdelete.show
count = count + 1
Loop
Edited by - piles on 6/20/2007 8:10:01 AM
Moving Data Between List Boxes
Hi,
I need a little help if anyone has a moment. I have 2 list boxes one called lstSource and the other is lstDestination. I have it set up and working so that I can multi select rows in my source and move them into my value list in my destination list box. I call the function in the click even of a right arrow button. This works great.
Now I want the user to be able to remove fields from the lstDestination in case they make a mistake or change their mind. I want to do this using a left arrow button but I can't quite get the code working properly. I have gotten it to do everything butx but....however, I can't get it to just delete the selected row(s). Here is my code that is working to move my rows from my lstSource to my lstDestination. I assume it must be some variation of this....
<vb code>
Private Sub cmdCopyItem_Click()
CopySelected Me
End Sub
Function CopySelected(frm As Form) As Integer
Dim ctlSource As Control
Dim ctlDest As Control
Dim strItems As String
Dim intCurrentRow As Integer
Set ctlSource = frm!lstSource
Set ctlDest = frm!lstDestination
For intCurrentRow = 0 To ctlSource.ListCount - 1
If ctlSource.Selected(intCurrentRow) Then
strItems = strItems & ctlSource.Column(0, _
intCurrentRow) & ";"
End If
Next intCurrentRow
' Reset destination control's RowSource property.
ctlDest.RowSource = ""
ctlDest.RowSource = strItems
End Function
</vb code>
Last List Box Item
I have a list box that is filled dynamically and I don't know in advance how many items it will contain. How can I get the last item value? Here is what I tried:
Code:
lstBibPlace.Index(lstBibPlace.ListCount - 1)
but that generated a 'wrong number of arguments' error message.
Thanks!
List Item I
I have a loop here for saving a list's contents. i want the i item of the list. how can i take that? and as soon as i save i want to store the i item read from the file put into the list. how can i do that too? thanks anyway for any answers....
Add Item To List Box
Hi,
Below is the code im using to sort a file into a list box.
Only thing is though im putting it into a rich text box first.
When i do this the file is to big and so when it goes to sort it i get an overflow error.
How can i chnage this code so it dosent go through the right text box and gets sorted into the list box straight away.
Code:
otext = Display.Text
mtext = Replace (otext , Chr$(0) , " ")
Display.Text = mtext
Dim Count As Integer
Count = 0
Dim sentence As String
sentence = "the fat cat eats fork.txd from the can"
Dim words() As String
words = Split(sentence) ' Split up the sentence into words
Dim i As Integer
For i = 0 To UBound(words) ' Loop through each word
Dim word As String ' Set the word to a variable
word = words(i)
If Right$(word, 4) = ".txd" Then ' If the word ends in .txd
Count = Count + 1
List1.AddItem Count & ": " & word
End If
Next i
Thanks for any help.
-Dave
Add An Item To List 6
I would like to add an item to list 6 after pressing a button.
the item simply and always says End of Search. Can anyone tell me how to do this?
Also I have a timer8 and it counts in seconds. Is there a way that when the button is pressed, the timer is enabled and starts to count, and as each second goes on, a labeltime.caption number is increased by one. And when the list 6 gets the end of search item added to it, the timer is disabled? thanks!
Add An Item In A List Box
I have a list box and i am trying to add elements as follows
ns = 4
Dim temp As String
For x = 1 To ns - 1
temp = "Stage " + x + " Oulet"
List1.AddItem temp, List1.ListCount
Next
Basically i would like the items in the list box to appear as follows:
Stage 1 Outlet
Stage 2 Outlet
Stage 3 Outlet
etc
A mismatch error comes up when i try to this!
I tried to change the + x + part of the expression to
+String(x) +
But this did no work either!
Please help !!!
List Box Item
I have to list box. If i add an item from list1 to list2 and the item already exists a beep sound
But how can i change the color of that item in list2 and make it blink?
Going To Next Item In List??
ok, here's a tricky one. Say I have 3 filenames in a listbox. when the user double-clicks on the file, my program calls on the Shellexecute API call to open the file with it's default program. ok say for example these are *.wav files. When the first file in the list is finished playing I want the program to automatically go to the next file in the list and use shellexecute to open it. So my question is: How can I get my program to recognize when the playing file has finished playing? Any suggestions, tips, flames, etc. appreciated. Thanks
-Jeremy
Last Item In List Box Seems To Be 0
Hi there
I have a listbox with checkboxes
I am looping through the selected items but it seems that it always makes the last item 0
CODE Dim n As Long
With courselist
For n = 0 To .lst_files.ListCount - 1
If .lst_files.Selected(n) = True And .lst_files.List(n) <> "" Then
MsgBox (.lst_files.List(n))
End If
Next
End With
Get Item From The List Box
Hi! Can you please help me on how to get the item from the list box... like if i click one of the item from the list box, i want it to be shown in a text box but i dont know how to do it. i have tried to set it by using adodc but the problem is i only get the first item and no more. Thanks a lot!!!
Next Item In List
I want to make it so that when i click a button(command1) it makes the listbox (list1) select the next selection in it. So everytime i click the button the selection moves down one. Can someone please help?
Searching For And Moving E-mails In An Outlook PST From A List In Excel Using VBA
Hi there,
I was hoping someone might be able to give me some guidance - I have the task of sorting various e-mails in a master PST, into seperate folders based on a list of e-mail addresses which have been extracted from the PST, and are stored as a simple Excel workbook.
the current list of addresses reaches around 5000 items, and so doing this manually would be a extremely burdensom task - I was hoping that this would made fairly simple by the use of a VBA marco, and it could be easily recorded however Outlook does not allow the recording of macros. I've also been reviewing various samples, but cannot make head nor tail of what needs to be done, and my experience with VBA is fairly limited.
Basically what needs to happen is:
- vba selects the e-mail address from a cell in Excel, and copies this value
- changes to Outlook, and performs a search on the Inbox for the copied value (e-mail adress) as the sender, and then moves any e-mail item found with this value to a seperate folder
- goes back to Excel, and repeats the process to select the next cell's value.
If anyone would be able to help or provide some guidance or sample code, it would be greatly appreciated!
Best regards,
Nick
|