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




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




View Complete Forum Thread with Replies

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

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?

Code For Moving Items Up/down List Box?
Anyone know how to move items up or down the order in a list box. Thx

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..

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>

Moving Scroll Bars On List Box Simultaneously
could someone please tell me if it is possible to somehow link listboxes in an array so they all scroll together? thanks

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

Help With File List , Dir List And Drive List Boxes..
How do i link my drive list , file list and dir list boxes to gether , so that when i for exaple set the drive list to c: , the dir list will then give all dir in there, and file list will show me files from the directory, right now the default file list is set to my vb file list and i cant change it...

How To Get List Of Files In File List Box Depending On Date
Hey,




I want to know how to get list of files in File List Box depending on particular date.

Please tell me how to do it.


With regards,

Praveena.

Moving Around File
if I need to delete a certain line from a file, how can i move to that line in write mode?

Moving A File
Hey there...

I'm wondering how i can move a file. I've been trying the api call, "MoveFile", but i cant seem to get it to work... Anyone??

Thanks,
Jordan

Moving Throughout A File
Hi. Im having trouble with saving in my map editor. This part isnt game related though. What im trying to do is open up a Temp File.. that works fine. but im trying to go to a certain part in it. Like. If i had a tile at 10, 15 i want to go down 15 spaces.. i could do a loop for that easy enough.. but how would i go over? actually in eed it to go over 9 and down 14 then but thats not the point. help appreciated. thanx

Moving A File
It should be simple. I have a file on a networked drive that I want to move to another computer.
Obj.copy doesn't seem to work as the file isn't seen as a declarable object.
How can I do this?

File Moving
VB Code:
filecopy(FullPaths.item(FileNames(x)) , dirPaste.Path)


when i write this line of code to copy files i get a message saying it expects a = sign

fullpaths is a collection with all entries having a key of their file name
Filenames contains the names of the files that are used to reference the paths

File Moving
Hello all,

I have this program where i move files from server to PC and PC to server and so on (you get the idea )

I want to set up a progress bar to display how much time is left, the problem is I have no idea how to do this.

Anybody know how or mabe has an example?

Thanks,
Rudy

File Moving...
I want to know how to move specific files to a different directory. I found some help at http://www.vb-world.net/files/shfileop/ but this isn't exactly what I want to do.

I want to have all files in c:/files that start with the letter A to go to c:/files/A, all files that start with B to go to c:/files/B, etc... To basically alphabetize the files. I'm having trouble figuring out how to do this... do I create some sort of loop that checks each filename, then moves it?

Moving A File
how do i move a file (text document) that the user selects to a designated folder?

Moving A File...
How would I go about moving a specific file, thats in the same folder as the program thats going to move it, to a different folder?

-Thanks

Moving A File
what i want to ask is:

Question: What is the best method to move a file around the network...........?

The methods i have are the 'Name', 'FSO', 'shell32.dd' (which is what i am cuurenlty using), MoveFile/MoveFileEx in the win32 api or is there anything else i'm missing...............

i want to use the fastest most effient method, but i have little info on any of these methods......

Can anyone help?
Thanks
Mark

Moving Data In A File
Hi guys,

I have a little "newbie" problem. I'd like to move all data in a file from offset 720 till the end to offset 640 and further. Is that possible?

Thanks in advance, Jan.

Moving A File From One Folder To Another
Excel 2002 with Visual Basic 6.3

I have a file, say it's called test.txt, in C:. During the course of running a particular macro I would like to find that file, move it and save it to another folder, say C:My Documents.

Any ideas for the procedure?

Thanks

Moving A File Problem
On my MOVE I get... file already exist, when it doesn't.


Private Sub Form_Load()
Dim fs, f, f1, fc, flName
Set fs = CreateObject("Scripting.FileSystemObject")
Set f = fs.GetFolder("c:workingatlantic")
Set fc = f.Files
For Each f1 In fc
flName = f1.Name
Debug.Print flName
f1.Move ("c:workingatlanticackup")
Next
End Sub

Help Moving The File Created
I got the next codes:



Code:
Private Sub Command1_Click()
On Error Resume Next
If GenerarArchivo(Dir1.List(Dir1.ListIndex) & "" & File1.List(File1.ListIndex)) Then
MsgBox "ECF File Successfuly converted"
File2.Refresh
End If
End Sub

Private Sub Command2_Click()
Shell "c:windows
otepad.exe " + Dir2.List(Dir2.ListIndex) + "" + File2.List(File2.ListIndex), vbNormalNoFocus
End Sub

Private Sub Command4_Click()
On Error Resume Next
If MsgBox("Are you Sure that you want to delete the file:", vbYesNo) = vbYes Then
Kill Dir2.List(Dir2.ListIndex) + "" + File2.List(File2.ListIndex)
File2.Refresh
End If
End Sub

Private Sub Command5_Click()
File2.Refresh
End Sub

Private Sub Command6_Click()
Shell "c:windows
otepad.exe " + Dir1.List(Dir1.ListIndex) + "" + File1.List(File1.ListIndex), vbNormalNoFocus
End Sub

Private Sub Command8_Click()
On Error Resume Next
If MsgBox("Are you Sure that you want to delete the file?", vbYesNo) = vbYes Then
Kill Dir1.List(Dir1.ListIndex) + "" + File1.List(File1.ListIndex)
File1.Refresh
End If
End Sub

Private Sub Command9_Click()
File1.Refresh
End Sub

Private Sub Dir1_click()
File1.Path = Dir1.List(Dir1.ListIndex)
File1.Pattern = "*.txt;*.sel; *.*.txt"
End Sub

Private Sub Dir2_Click()
File2.Path = Dir2.List(Dir2.ListIndex)
File2.Pattern = "*.ECF;*.ECP;*.ECE;*.ECB"
End Sub

Private Sub Drive1_Change()
On Error Resume Next
Dir1.Path = Left$(Drive1.Drive, 1) & ":"
End Sub

Private Sub Timer1_Timer()
End Sub

Private Sub Drive2_Change()
On Error Resume Next
Dir2.Path = Left$(Drive2.Drive, 1) & ":"
End Sub

Private Sub Form_Load()
File1.Path = Dir1.List(Dir1.ListIndex)
File1.Pattern = "*.TXT;*.SEL; *.*.TXT"
File2.Path = Dir1.List(Dir1.ListIndex)
File2.Pattern = "*.ECF;*.ECP;*.ECE;*.ECB"
End Sub
Function GenerarArchivo(ByVal sNombre As String) As Boolean
On Error GoTo Error:
Const HEAD = "TYPE"
Dim iArch1 As Integer
Dim iArch2 As Integer
Dim slinea As String
GenerarArchivo = True
iArch1 = FreeFile
Open sNombre For Input As #iArch1
iArch2 = FreeFile
Open Left(sNombre, Len(sNombre) - 4) & ".ecf" For Output As #iArch2
'paso la primer línea
If Not EOF(iArch1) Then Line Input #iArch1, slinea
stexto = HEAD + slinea
While Not EOF(iArch1)
stexto = stexto + "," + vbCrLf
Input #iArch1, slinea
stexto = stexto + slinea
Wend
Print #iArch2, stexto
Close (iArch1)
Close (iArch2)
Salir:
Exit Function
Error:
MsgBox "Error:" & Err.Description
GenerarArchivo = False
Resume Salir
End Function

What about now?
Sorry for the space.

2 windows where after presing the button create and rename the file but left the file renamed in the directory from the second windows. the problem is that the file is renamed but still in the same dir where I the old file is. Can somebody help me?

Moving In Text File
I have open a text by
open #textfile for input as f_handle

i am moving/reading the file by
line input

if centain condition is not fulfilled i have move a line back ie i have to go to previous line


How i can do that in VB please tell

in foxpro fseek fuction return the current position of the file
which i used for above problem but i dont know how it is used in VB

Please help

Some File Moving Questions
How do u create a new directory?
How do u copy a file from one path to another?

Moving A File Before Saving The New One
I am working on project in EXCEL, using VBA. I have a command button which
creates a text file that gets uploaded into a software package we have.
Before the file gets saved, I want to move the old file into an archive
folder on a network drive.

Can anyone help me with code for this?

Bill Krupinsky
Performax - ISG
1050 Hull Street
Baltimore, MD 21230
410-986-2080
email@removed



Please visit us at www.GetPERFORMAX.com

Note: The information contained in this message may
be privileged and confidential and protected from
disclosure. If the reader of this message is not
the intended recipient, or an employee or agent
responsible for delivering this message to the
intended recipient, you are hereby notified that
any dissemination, distribution or copying of this
communication is strictly prohibited. If you have
received this communication in error, please notify
us immediately by replying to the message and
deleting it from your computer.

Menu List To List The File Name Which Have Opened.
How to write the code to let the menu show a list of file name which had been opened.(history which file had openned)
in addition, if click the name in that list.the file will open again.

Problem - Moving A File Using Variable Name
OK, I have a problem, i`m fairly new to VB so this is probably easy to anyone with some experience.

I have done some importing of files (namely csv's) from a specific directory. Once they are imported, I want to move them to a sub-directory called "processed".

I have been trying to use the "Name.....As" code, for example

Name "C:ADirThisFile.txt" As "C:ThatDirThisFile.txt"

but I need to use a variable name rather than a hard-coded filename. This is because this code is in a loop and the filename of the file to be moved changes with each execution of the loop.

for example

Name filename As ".processed" filename

this obviously doesnt work....any suggestions....????

Moving Multiple .DAT Files Into One .DAT File
I need to move all of the .dat files in a directory to one large .dat file. I have been successful in moving one .dat file at a time, but not the entire directory. Below is the current code that I have. What do I need to change so that all of the files will be read and moved at once?

Here is the code.

VB:

Option Explicit

Private Sub Form_Load()

On Error GoTo Err_Form_Load
'Open Dialog box to select multiple files
With CommonDialog1
.DialogTitle = "Woohoo"
.InitDir = App.Path
.Flags = &H200& + &H4&
.Filter = "Data files (*.dat)|*.dat"
.Action = 1
End With

'Input #1
Open CommonDialog1.FileName For Input As #1

Err_Form_Load:

End Sub

Private Sub cmdRun_Click()

Dim sTemp As String

'Open file to be written to
Open "s: est_fold est2.dat" For Append As #2

Do Until EOF(1)
Input #1, sTemp
Write #2, sTemp
Loop

Close #1
Close #2

End Sub

Moving And Changing Bytes In A File
I've decided to create a EXTREMELY basic encrpytion method that involves moving and swapping bytes in a file. Sure, it's not very secure, but it keeps normal people out of the file . I intend to keep the code very simple, and i intend to just make a library, so that other people can use this in their programs.

What i need to know is how i can change bytes in a file. I've looked through the appropriate seconts of the forum, but to no avail. The appropriate posts either involve binary (too low), or ASCII or some other form of text (too high).

EDIT: I suppose there might be a way to get the binary and mathematically transform it in and out of hexadecimal form, but so far i haven't figured that out.

Moving Multiple File From Filelistbox
Hi All,

I have searched the forum and found some discussions on filelistboxes. I am doing what has already been previously suggested in those discussions but I am not getting the desired result.

I have a list of jpeg images in a filelistbox. The filelistbox multiselect property has been set to 2 - extended. The filelistbox does highlight a block of files when selected (click once on the top file, then hold down the shift key and select somewhere in the middle of the file list box), but when I try to copy the selected files only the last file is copied. My code is attached, any help offered will be greatly appreciated, I am sure it will be something simple


Code:
For i = 0 To FileSub.ListCount - 1
If FileSub.Selected(i) = True Then
TempStr1 = FileSub.Path & "" & FileSub.List(FileSub.ListIndex)
TempStr2 = FileTemp.Path & "" & FileSub.List(FileSub.ListIndex)
FileCopy TempStr1, TempStr2
End If
Next i

FileTemp.Refresh

Alittle Help With 'moving A File Into A Directory'
hi everyone im new here, i was referred by a friend, and i need alittle help on a simple program. it containes two buttons. the first i am using shell to call a program(no problem there)

but i have trouble doing this
i need a button to move c:/Program Files/xxxxxx/xxxxxxxx/splash.jpg to c:/Program Files/xxxxxxxx/xxxxxxxxx/xxxxxxxxx

i put the x'es cause the path is irrelevant. i just need alittle help on how i can move one file into a folder directory


thx alot

~g3nuin3

Alittle Help With 'moving A File Into A Directory'
How about a button to delete c:Program Filesxxxzzzcccsplash.jpg
and then copy c:Program Filesxxxzzzsplash.jpg to c:Program Filesxxxzzzcccsplash.jpg (where we just deleted splash.jpg)

File Moving Without Existing Destination
I have a file that I want to move to a folder however I don't have the same
file in the existing folder. I have a OpenFileDialog that the member uses to
select the file and move the file name into the text box. Then I have a
secondary FolderBrowserDialog that the member uses to select the folder to move it
to. All the selections are made however when I try to move the file it comes
to System.IO.File.Move(Source, Destination) however it doesn't like it
because it says that the Destination Folder already exist I'm not trying to create
the folder I just want to move this file inside of it. Any ideas. Sorry if
this is basic I am trying to learn

Shawn

Finding Out If A File Is Locked Before Moving It
Hi,

I need to move files from one directory to another during run time, with the file system object.
How can I make sure that the files are not locked (still being written) before I attempt to move them ?
Is there a IsLocked function of some kind ?

Dani

Code For Moving To The First Blank Cell In A Worksheet; Moving Left,right,up Or Down
I have created an application form as a userform in Excel. I need to send the data entered into my text boxes when the program runs to separate excel cells in a worksheet.

My problem is I can use code that will send the textbox entry to a specific cell eg. If my textbox is named Surname I can say

range("a5").value = surname but if I do that when I run the programme to enter the next record for someone else the first record will be overwritten.

I NEED A CODE LINE THAT WILL TAKE ME TO THE FIRST EMPTY CELL AND ALLOW ME TO MOVE DOWN OR TO THE LEFT OR TO THE RIGHT

Moving Or Saving A .mdb File To Another Folder Code
eiy guys,, i need a code that will move or save as my database.mdb
located on C:

and move it to D:/backup/

please give me the code and the proper preferences to click

please email me at pwedepobangmagtanong@yahoo.com

Moving A File From One Folder To Another {updating Hyperlinks}
Thank you!!! I was looking for help moving files from one folder to another.

But I have a question...and this may be a little above my league (started learning VBA a month ago)

After I have moved the files, how do I update my hyperlinks within Excel?

Thanks in advance.

Copy+moving File And Creating Folder That
My first post, this forum is great.

I searched and found how to move a file to a diff. dir using FSO object. Here is my situation. I want to create the destination folder so it displays that days date.

I'm moving "c:projects*.fdd" files ----> c:projects?

Where the question mark is i want a folder created to reflect that days date.

Thanks.

MoveFile Does Not Work When Moving File In A Variable
Hello, I have a form that first it gets the name of the file and stores it in a variable. When I try to do the fso.MoveFile (<souce folder> & <name of the file>),<destination folder> it does not work. If I say "*.*" it will move all files in the source folder but I only want to move the one in the variable. How can I do that?

Thanks.

CODEIf fldr.files.count >= numberOfFiles Then
   
  For Each fil In fldr.files
  
  If Right(fil.ShortName, 3) = "TIF" Then
      If fil.DateLastModified < oldestDate Then
        oldestFile = fil.path
        oldestDate = fil.DateLastModified
      End If
  End If
  
  Next
  
  ShowFileList = oldestFile
   
  MsgBox oldestFile ' show me file name in a msgbox
  
  filename = oldestFile
  
  fso.MoveFile (sfolder & fso.GetFileName(oldestFile)), dfolder
End If

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