Results 1 to 4 of 4

Thread: Easy question regarding Lists (Resolved!)

  1. #1

    Thread Starter
    Frenzied Member JungleMan's Avatar
    Join Date
    Feb 2001
    Posts
    2,033

    Easy question regarding Lists (Resolved!)

    Hey..I have a ListBox with a bunch of paths to files in them, and what I want to do is have it cycle through the whole listbox and do something with each entry in the listbox...specifically, they are paths, and I want to run them with the Shell() function.

    I'm not really proficient in VB (most of my postcounts are from the GenPC forum ) so if someone can clue me in on how to do this I'd appreciate it...
    Last edited by JungleMan; Oct 6th, 2002 at 01:45 PM.
    I'm bringing geeky back...

  2. #2
    Randalf the Red honeybee's Avatar
    Join Date
    Jun 2000
    Location
    off others' brains
    Posts
    4,345

    Well ...

    Originally posted by Jungle-Man
    ...
    I'm not really proficient in VB
    No kidding!

    VB Code:
    1. Dim I As Integer, strPath As String
    2. For I = 0 To List1.ListCount -1 Step 1
    3.     strPath = List1.List(I)
    4.     'Do Whatever You Want With strPath
    5. Next I

    .
    I am not a complete idiot. Some parts are still missing.
    Check out the rtf-help tutorial
    General VB Faq Thread
    Change is the only constant thing. I have not changed my signature in a long while and now it has started to stink!
    Get more power for your floppy disks. ; View honeybee's Elite Club:
    Use meaningfull thread titles. And add "[Resolved]" in the thread title when you have got a satisfactory response.
    And if that response was mine, please think about giving me a rep. I like to collect them!

  3. #3
    PowerPoster
    Join Date
    Aug 2000
    Location
    India
    Posts
    2,288
    Is this wat you want:
    VB Code:
    1. Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long
    2. Const SW_SHOWNORMAL = 1
    3.  
    4. Private Sub RunFile()
    5. Dim intCounter As Integer
    6. Dim intListCount As Integer
    7.     intListCount = List1.lictcount - 1
    8.     For intCounter = 0 To intListCount
    9.         ShellExecute Me.hwnd, vbNullString, List1.List(intCounter), vbNullString, "C:\", SW_SHOWNORMAL
    10.     Next
    11. End Sub

  4. #4

    Thread Starter
    Frenzied Member JungleMan's Avatar
    Join Date
    Feb 2001
    Posts
    2,033
    Thanks Honeybee...and you too amitabh but I didn't try your code, honeybee's worked

    No kidding!
    Well I don't really program VB much. I am writing a benchmarking app (believe me, it is NOT as hard as it sounds! just generating and executing commands, and parsing a log file) for UT2003
    I'm bringing geeky back...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width