Store the Application Paths in an Array and use the ListIndex Property of the Listbox to Reference the List and Extract the Correct EXE Name/Path, this way the Actual List Item can contain any Text you wish. I would also use an external file to build the list of files, this way you can add/delete files without having to rebuild your application, ie.
In a Flat File, "Apps.lst"..
Application CodeNotepad
notepad.exe
Calculator
calc.exe
MS Paint
mspaint.exe
Adobe Acrobat 4
C:\Program Files\Adobe\Acrobat 4.0\Reader\AcroRd32.exe
MS Money
C:\Program Files\Microsoft Money\System\MSMONEY.EXE
Copernic 2000
C:\Program Files\Copernic 2000 Plus\Copernic.exe
Lotus Notes
C:\Lotus\Notes\notes.exe
WinZip
C:\Program Files\WinZip\WINZIP32.EXE
Quick Time
C:\Program Files\QuickTime\QuickTimePlayer.exe
Aventail
C:\Program Files\Aventail\Connect\as32.exe
CRT
C:\Program Files\CRT\CRT.EXE
FTP Voyager
C:\Program Files\Rhino Software\FTP Voyager\FTPVoyager.exe
Skin Builder
C:\Program Files\ActiveSkin\SkinBuilder.exe
------------------Code:Dim aApps() As String Private Sub Form_Load() Dim iFile As Integer Dim iApp As Integer Dim sData As String Dim vSplit As Variant iFile = FreeFile Open "C:\Files\Apps.lst" For Input As iFile sData = Input(LOF(iFile), iFile) Close iFile vSplit = Split(sData, vbCrLf) ReDim Preserve aApps(UBound(vSplit) / 2) For iApp = 0 To UBound(vSplit) Step 2 List1.AddItem vSplit(iApp) aApps(iApp / 2) = vSplit(iApp + 1) Next End Sub Private Sub List1_DblClick() Shell aApps(List1.ListIndex), vbNormalFocus End Sub
Aaron Young
Analyst Programmer
[email protected]
[email protected]




Reply With Quote