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




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




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Double Click And Item In A List Box To Open A Sheet
Is it possible (after populating a listbox) that if the user double clicks an item in a list box that eack item will open different excel spreadsheets (excel need not be running initially). Please remember that I am relatively new at this in any reply

Thank you

How To Create A List Of Files In A Folder
I need to create a list of files found in a given folder. Ideally, it would be a .txt file that contains the list.

I searched this forum, but wasn't sure what to search for.

Any help is greatly appreciated. Thanks to all who reply!!!

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

List Box Double Click Event In VB 6.0
I am trying to write code in listbox double click event to check if the item is selected.
If it's select, unselect it.
If it's unselected, select it.

Does anyone know how to do it?

Thanks!!

MSFlexGrid Double Click And Add To List Controll
I have a MSFlex Grid that gets data from a search from an Access DB.

I wanted to be able to double click on the MSFlex Grid, and have it put the "ORDER_Num" into a ListBox.

Any ideas?

I later wanted to be able to export all the items in the listbox, to excel.

Also on another note, is how would i make a "back" button, so that if i were to mess up on a record, i can delete the last entry in the listbox?

here is my code so far


VB Code:
Private Sub MSFlexGrid1_DblClick()    If rs.State = adStateOpen Then rs.Close    With MSFlexGrid1        StrID = .TextMatrix(.MouseRow, 0) '1 is the column with the ID, if its not 1 change this    End With    sSQL = "SELECT * FROM [Lamp Exchanges Table] WHERE ID = " & StrID    rs.Open sSQL, cn, adOpenForwardOnly, adLockOptimistic    If Not rs.EOF Then    ' Updates all the fields when double clicking on the MSFlexGrid    ' This just puts the values of what ever is in the db, into the lower section.    ' We add " vbNullString because, if there is an blank value it will give an error  Label27.Caption = rs.Fields("ID").Value  Label28.Caption = rs.Fields("CASE_Num").Value  Label29.Caption = rs.Fields("FN").Value + " " + rs.Fields("LN").Value  Label30.Caption = rs.Fields("ADDR1").Value  Label31.Caption = rs.Fields("Addr 2").Value & vbNullString  Label32.Caption = rs.Fields("City").Value + "," + rs.Fields("State").Value + " " + rs.Fields("Zip").Value + vbNullString  Label33.Caption = rs.Fields("LAMP_Num").Value  Label34.Caption = rs.Fields("QTY").Value  Label35.Caption = rs.Fields("TRACK_Num").Value  'Label36.Caption = rs.Fields("Ship Date").Value  Label37.Caption = rs.Fields("ORDER_Num").Value  End If    If rs.Fields.Item("CLOSED").Value = True Then   Check1.Value = vbCheckedElse   Check1.Value = vbUncheckedEnd IfEnd Sub

Right Click On A List Item
Is there a way to get the list.list with the right mouse click.
So if someone kliks with the right mouse button I want to get
the list.list(x), where x is the one under the mouse button.
and then show something (a pop-up menu) right under the mouse button.
Is this possible ??? Please help

Want Right Click To Select Item In List
I have a listbox where I want a click of the mouse's right button on an item to select that item just like the left button does.

How would I do that ?

Thanks,
John

Right Click For Popup Menu, But Select The Item Right Clicked Upon [List Box]
Hi,
  I have a list box which holds several list items (logs). I want to right click on the individual list items and select them (which only works with left click) and then show a popup menu.
  The list item must be selected because the popup menu would have commands specific to the 1 file. E.g. delete log

 How do I accomplish this?

Thanks in advance

--------------------------------------------------
Should I apologize if what I say burns your
ears and stains your eyes?!

Selecting A Folder With A Dir List Box With Only A Single Mouse Click
I was wondering if there was an easy way to access folders on a dirlist box using a single mouse click.

For instance:

c:
windows

is displayed in a dirlist box

It takes a double mouse clickon windows to go to system32:

c:
windows
system32

Do I have to write a click event for the dirlist so that it somehow does a double click? I would think there
would be an easier way.

Sorry this sounds really dumb. My users are complaining about the double click.







Edited by - AbbydonKrafts on 5/23/2007 6:44:12 AM

Does Any Body Know How To Automaticly Create An Item In A List View
I Need To Know How To Automaticly Create An Item (With An Icon) In A List View with a command click Instead of already having an item there PLEASE RESPOND OR EMAIL ME HERE

Does Any Body Know How To Automaticly Create An Item In A List View
I Need To Know How To Automaticly Create An Item (With An Icon) In A List View with a command click Instead of already having an item there. PLEASE RESPOND OR EMAIL ME HERE

How Can You Create A Folder List Like In Winzip?
when a file is extracted to a folder, theres a different listbox that shows all the folders in a drive. how can i use one of those for my program?

List Of Files In A Folder
how can i get a list of all files in a folder and put it in a array or something?
thank you

List Folder Files
Hi, anyone know the API call to list files by type, name, size......on a folder?? Tks for the help.

List Files In A Folder?
is a way with standard vb?

List All Files In A Folder
Hi,

I've written a simple list all files in a directory using FSO.



VB Code:
Sub GetFiles(Path As String, Ext As String, ResultFileCount As Integer, ResultFileName As String, ResultBeforeDot As String)Dim FSO As New FileSystemObjectDim f, f1, FileList()Dim i As IntegerDim j As Integer        i = 0    Set f = FSO.GetFolder(Path)        For Each f1 In f.Files        If LCase(Right(f1.Name, 3)) = Ext Then            i = i + 1            ReDim Preserve FileList(i)            Set FileList(i) = f1        Else            GoTo EndRoutine                    End If' Put the filename and count in the varibles     ResultFileName = ResultFileName + f1 + vbCrLf     ResultFileCount = i     ResultBeforeDot = Mid$(f1, Len(Path) + 1)    NextEndRoutine:End Sub



The problem that I get is the following.

Got 10 files with the extention of .eps and try and look for a file with .bat It will only look at the eps and not the extention.
I'm wanting to use this as a replacment for FileListBox. This bit of code runs in a module, if thats any help.

Please contact me if more information is needed.

Many thanks for all your help. Merry Christmas..

List Files In A FTP Folder
Is there a way to list all files in a certain FTP folder (without downloading them)?

How Can You List All Files In A Folder?
anyone know? including all subfolders, and files in them..

List *_*.doc Files In A Folder
Hi all!

I need to list all files with a certain prefix and ending with .doc in a folder. How do I do this the easiest way? It can be several files. I've tried the Dir function but it only returns the first matching file.

GunYan

List Files In Folder
Hi!

Does anyone know how to list all af the files (not folders) in a folder, including the files in the sub-folders?

Thanks!

How To Get A List Of Files In A Folder?
Hi, anyone know the aPI for getting a list of files in a directory?

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

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

File List And Double Click Open File Option - VBA
I have set up a macro which asks for a file name and when given, it finds
the file, executes through VBA code taking the text file and transferring it
to Excel and renaming and adding tabs, etc.....My question is, how can I set
it up so instead of gathering the text file names from one place I can just
run the macro and it will give me a file list set to choose from, then I
just double click the file and it runs the rest of my macro?

Any help anyone can give is greatly appreciated.
Here is my code as it is now.....

Sub New_Eload_Macro()

Dim DateTime As String
Dim Mydata
Dim DataObject

DateTime = InputBox(prompt:="Please Input DateTime Stamp")
Workbooks.OpenText FileName:= _
"C:Eload_Prt_FilesELOAD_ACT_" & DateTime & "_INPUT001.PRT",
Origin:= _
xlWindows, StartRow:=1, DataType:=xlFixedWidth,
FieldInfo:=Array(Array(0, _
1), Array(15, 1), Array(19, 1), Array(29, 1), Array(34, 1),
Array(42, 1), Array(47, 1), _
Array(52, 1), Array(56, 1), Array(72, 1), Array(88, 1), Array(101,
1))
Rows("1:1").Select
Selection.ClearContents
Rows("4:5").Select
Selection.Delete Shift:=xlUp
Range("B1").Select
ActiveCell.FormulaR1C1 = "ELOAD ACTIVITY LOG"
Rows("2:2").Select
Selection.ClearContents
Columns("A:A").Select
Selection.Delete Shift:=xlToLeft
Columns("A:K").Select
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlBottom
.WrapText = False
.Orientation = 0
.AddIndent = False
.ShrinkToFit = False
.MergeCells = False
End With
Columns("A:K").EntireColumn.AutoFit
Range("A1").Select
With Selection
.HorizontalAlignment = xlLeft
.VerticalAlignment = xlBottom
.WrapText = False
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.MergeCells = False
End With
Selection.Font.Bold = True
Range("A3:K3").Select
Selection.Font.Bold = True
Columns("A:A").ColumnWidth = 7
With Selection.Borders(xlEdgeBottom)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
Selection.Borders(xlEdgeRight).LineStyle = xlNone
Selection.Borders(xlInsideVertical).LineStyle = xlNone
Columns("E:E").Select
Selection.NumberFormat = "0000"
Columns("G:G").Select
Selection.NumberFormat = "000"
Range("A1").Select
ActiveWorkbook.ActiveSheet.Select
Sheets.Add
ActiveWorkbook.ActiveSheet.Select
ActiveWorkbook.ActiveSheet.Name = "Error Log"
Range("A1").Select
Sheets("ELOAD_ACT_" & DateTime & "_INPU").Select
Sheets("ELOAD_ACT_" & DateTime & "_INPU").Name = "ELOAD_ACT_" & DateTime
& ""
Rows("61:65").Select
Selection.Delete Shift:=xlUp
Rows("123:127").Select
Selection.Delete Shift:=xlUp
Rows("185:189").Select
Selection.Delete Shift:=xlUp
Range("A1").Select
Workbooks.Open FileName:="G:Data ControlEload
LogsErrorLogTemplate.xls"
Cells.Select
Selection.Copy
Windows("ELOAD_ACT_" & DateTime & "_INPUT001.prt").Activate
Sheets("Error Log").Select
ActiveSheet.Paste
Range("A1").Select
Windows("ErrorLogTemplate.xls").Activate
ActiveWindow.Close
Windows("ELOAD_ACT_" & DateTime & "_INPUT001.prt").Activate
ChDir "G:Data ControlEload Logs"
ActiveWorkbook.SaveAs FileName:= _
"G:Data ControlEload LogsELOAD_LOG_" & DateTime &
"_INPUT001.xls", _
FileFormat:=xlNormal, Password:="", WriteResPassword:="", _
ReadOnlyRecommended:=False, CreateBackup:=False
End Sub

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

How To Change Back Color Of List Item In List View
Dear members,

i am having small problem with listview control , I want to assing alternate colors to list items, but i con't,

hope someone will help

regards
D.L.Narayana

List And Search Files In A Folder
Hi all, now i need to open a folder and search for some files have the same extention name, lastly list all the file names.

Eg: the folder contains different kind of files, some files' names are "xxxx.0D9", some files' names are "xxxx.0D3"....etc, so now i need to open the folder and find out all the files named with extention ".0D3" and show the file names out in a textbox.

Could you tell me is there any build in function to open a folder ? (let's say the path of the folder is "C:Documents and SettingsDesktopSample")
or any suggestion? Thank you in avdance !

Listing All Files In A Folder To A List Box
I want to avoid having to use the comdlg32 control, so what is the easiest way to list all files (with or without a specific file type) of a designated folder in a listbox?

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

Change Background /Forgroound Of Each List Item In A List Box
How would i be able to change the back color of a listitem in a list control ? For example i want item number 1 to have a red background item number 2 to have a blue background etc.
Thanks for the help

Jerry

Select Folder Dialog. List All Folders And Subfolder In List View
Hello all.

I am trying to select a folder in a folder dialog. I then want it to list all the folders and subfolders and files within the selected folder in the list view.

this is what i have so far. It just lists all the first children folders of the selected folder. any help on this?


Code:
Private Sub addFolders()

FolderBrowserDialog.ShowDialog()

ListView1.Items.Add(FolderBrowserDialog.SelectedPath) 'lists top selected folder

Dim STF As New IO.DirectoryInfo(FolderBrowserDialog.SelectedPath)
Dim F As IO.DirectoryInfo
'lists each folder inside top folder
For Each F In STF.GetDirectories()
ListView1.Items.Add(F.Name)
Next

End Sub

VB6 - List Files In Folder To Array Question
VB6: I keep getting a type mismatch on this, and have no idea why. My goal is to create an array called sFiles, and have the function polulate it with each file name in the folder.

I've been so preoccupied learning .NET, I think I've forgotten VB6.

Thanks for any help you can provide.

Code:
Dim sFiles() As String
Dim lCtr As Long
sFiles = AllFiles("C:Work")
For lCtr = 0 To UBound(sFiles)
MsgBox sFiles(lCtr)
Next


Private Function AllFiles(ByVal FullPath As String) _
As String()

Dim oFs As New FileSystemObject
Dim sAns() As String
Dim oFolder As Folder
Dim oFile As File
Dim lElement As Long

ReDim sAns(0) As String
If oFs.FolderExists(FullPath) Then
Set oFolder = oFs.GetFolder(FullPath)

For Each oFile In oFolder.Files
lElement = IIf(sAns(0) = "", 0, lElement + 1)
ReDim Preserve sAns(lElement) As String
sAns(lElement) = oFile.Name
Next
End If

MsgBox sAns()

ErrHandler:
Set oFs = Nothing
Set oFolder = Nothing
Set oFile = Nothing
End Function

List The Files Or Folders In A Folder....[solved]
How can I see(list, write in a textbox) the files and folders(e.g: all files & folders in C:) using VB Code(I dont want to use common dialog since the program should do this part on his own)... Any help will be appreciated.

How Can Get Name Of All Files And Folrer List, That Exist In A Folder?
hello
please help me!
how I can get name of all files an folder that exist in a folder?
thanks.

List The Names Of The Files In A Folder In An Active Sheet
Greetings!
Thought this would be a cinch to find but, I have been to several forums as well as MSDN...nothing...
All I'm looking to do is to list the names of all the files in a folder in Column A of an Excel spreadsheet...seems simple...am I looking at it but just not seeing the answer?

as always...Thank You!

Piece Of Codes To List All Files (and In Sub-dirs) In Specified Folder ?
*I'm not talking about using Dir, File controls to show up the folders and files visually. But I'm talking about a code that will output the file locations.

I want to know how to output the result of detected files in specified folder I want to search for and put the result (Not 1 big result but keep updating 'string' variable with each of files it detects.

Let's say I want to search for files in this folder (test_patch) including files in it's sub-folders

The folder looks like this.

C:
- test_patch [FOLDER]
-- game_main.exe
-- patch1.pk3
-- patch2.pk3
--- dll_files [SUB-FOLDER]
--- engine.dll
--- kernel.dll
---- original_dll [SUB-FOLDER AGAIN]
---- engine.dll
---- kernel.dll

and I want the program to output these values.

game_main.exe
patch1.pk3
patch2.pk3
dll_filesengine.dll
dll_fileskernel.dll
dll_filesoriginal_dllengine.dll
dll_filesoriginal_dllkernel.dll

(cuts off full path, only show path in specified folder [means cuts off C: est_patch)

Thanks !

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

Sending Data From One List Box To Another List Box At A Click Of A Button
Hey guys,

First post at visualbasicforum.com! I need some help with a function on my college project.

I want to know how to copy data from one list box to another list box on a different form.

Want to be able to handle multiple lines on the list box and also happen when i click a button.

I know how to send from text to text for label to label:

frm2form.label1.caption = label2.caption

But, I've found list box to list box a bit more difficult and can't get it right!

Thanks in advance guys!

How To List The Items Of Combo List When It Get Focus Without Click On It
Hi:
Here I have problem, I have a Combo list. If the user don't want to use mouse, and She want the Combo list list all of of it's item just like mouse click on it when she use TAB to focus on it. How can I implement this function. If anybody know about it. It will be very helpful
Millions of Thanks.


wky086

Create Tree From List Of Files
I have a list of files like that:

Code:
c:folder1file.txt
c:folder1file2.txt
c:folder1file3.txt
c:folder1file4.txt
c:folder1subfolderfile.txt
c:folder1subfolderfile1.txt
c:folder1subfolderfile2.txt
c:folder1subfolderfile3.txt
c:folder1subfolder estfile.txt
c:folder1subfolder estfile1.txt
c:folder1subfolder estfile2.txt
c:folder2file.txt
c:folder2subfolderfile.txt

AND SO ON


Can someone tell me any possible way to make a tree out of that data?

Create A Property Window Dropdown List AKA Listbox List/ItemData
I'm trying to create an enhanced listbox control (in VB6) and one of my main criteria is to make it funtion very similarly to the standard listbox control.
Creating dropdown lists of constants (i.e. the Style property) is easy enough. but I haven't been able to re-create the ability to add (array) items in the property window such as is possible with the standard Listbox List and ItemData properties.
Anyone know how (or if) this can be done in VB6?

Regards

Ant

Flexgrid Item Double-Click
Is there any event that does the equivalent of double-clicking on an item in the flexgrid? The normal double-click event is for the entire flexgrid, correct? Thanks for the help!

Capturing A Double-click On A ListView Item
How would I go about detecting double clicks on ListView items? I've looked at the DblClick, ItemClick and Mousedown events, but it seems the only way I can effectively do it is detect a single click and then use a timer with a short interval and wait to see if another click event occurs within the interval (very long-winded, in other words). Come on, Windows uses it all the time, there HAS to be an easier way...

Double Click Listview To Edit Item
Is it possible to trigger the labeledit event, or somehow get the listitem to be editable, by double-clicking it?

Double Click On Select Item In A Grid
Hello,

I have a vb form that contains two tabs. The first tab contains combo boxes to display items from an access database. The second tab I'm displaying a list of folders like a tree structure. Similar like window explorer does. My problem is that when I click to the select the folder and then double click anywhere else in the form grid the folder open. The folder should only open when the folder has the focus and the double click. Any ideas or sample code to prevent this from occurring.

Thanks.

Anthony

Listview Double Click - How Can You Grab The Text Of The Item Clicked?
when you double click an item in a listview, how can you get the actual text that was double clicked?

Tracking The Folder Double Click In The Explorer
hi,

stoping the double click on the folders at specific path from vb code.


thanks,

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