Visual Basic
  Home arrow Visual Basic arrow Page 3 - Creating an HTML File List with VB
Dev Articles Forums 
ADO.NET  
Apache  
ASP  
ASP.NET  
C#  
C++  
ColdFusion  
COM/COM+  
Delphi-Kylix  
Design Usability  
Development Cycles  
DHTML  
Embedded Tools  
Flash  
Graphic Design  
HTML  
IIS  
Interviews  
Java  
JavaScript  
MySQL  
Oracle  
Photoshop  
PHP  
Reviews  
Ruby-on-Rails  
SQL  
SQL Server  
Style Sheets  
VB.Net  
Visual Basic  
Web Authoring  
Web Services  
Web Standards  
XML  
Mobile Linux 
App Generation ROI 
IBM® developerWorks 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
VISUAL BASIC

Creating an HTML File List with VB
By: Tim Haight
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 85
    2004-01-05

    Table of Contents:
  • Creating an HTML File List with VB
  • Setting Up Your Program
  • Coding the Program
  • Opening the Dir.txt File and Creating the HTML File
  • Compiling the File and Wrapping Up

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    Creating an HTML File List with VB - Coding the Program


    (Page 3 of 5 )

    Since the program will run by clicking the Run Catalog button, you will need to create a click event for this object.  To do this, double click the Run Catalog button. The code window will open, and will create a sub routine called cmdCatalog_click().

    The next few sections will describe the code logic.

    Error Checking

    To try and prevent the program from causing problems in case it crashed, some error checking should be added.  With this error checking added, here is the sub routine so far:


    Private Sub cmdCatalog_Click()
    On Error GoTo Err_cmdCatalog_Click
    Exit_cmdCatalog_Click
    :
        
    Exit Sub
    Err_cmdCatalog_Click
    :
        MsgBox Err
    .Description
        Resume Exit_cmdCatalog_Click
    End Sub

    Creating the Picture Directory List

    To create the directory listing, we would use the shell command to run a DOS command.  Because Windows 2000 does not have the dir.com file, you would get file not found errors, so I used a batch file called dir.bat.  Here is the sub routine so far


    Private Sub cmdCatalog_Click()
    On Error GoTo Err_cmdCatalog_Click
      
    'run directory listing
      '
    put the path in the shell command where you put the dir.bat file
      Dim RetVal
      RetVal 
    Shell("d:picturesdir.bat"1)    ' Run dir.bat
    Exit_cmdCatalog_Click:
        Exit Sub
    Err_cmdCatalog_Click:
        MsgBox Err.Description
        Resume Exit_cmdCatalog_Click
    End Sub

    You will need to create a batch file, and save it as dir.bat   As the remarks note, put this file somewhere, and change the path in the shell command.


    dir *.jpg /dir.txt
    dir 
    *.gif />> dir.txt

    More Visual Basic Articles
    More By Tim Haight


     

    VISUAL BASIC ARTICLES

    - Developing an XML Web Service Using Visual S...
    - Creating an HTML File List with VB
    - Fun with Email: VB6, CDO, MAPI, and a Remote...
    - Extranet/Intranet Dictionary Cracker in VB
    - Finding Default App Icons With Visual Basic
    - Registry Fever With Visual Basic
    - Implementing An ADO Data Control With VB6
    - Printing With Visual Basic
    - MSMQ Part 1/2: Architecture and Simple Imple...
    - Magnifying The Desktop With Visual Basic
    - Sending Email With MAPI Components in Visual...
    - Two Person Chat With The Winsock Control And...
    - A Real-Time ActiveX News Control
    - Accessing the Windows API in Visual Basic







    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 1 Hosted by Hostway
    For more Enterprise Application Development news, visit eWeek