Home arrow Visual Basic arrow Page 3 - Creating an HTML File List with VB
VISUAL BASIC

Creating an HTML File List with VB


Visual BasicYou just got that shiny new digital camera, and then you downloaded a bunch of digital pictures to your computer. Next you want to create a simple Hypertext Markup Language (HTML) file so that you can burn the picture and HTML files to a CD that you can send to all your friends and family.  How do you do this without having to manually code the HTML file? The following instructions will show you how. 

Author Info:
By: Tim Haight
Rating: 4 stars4 stars4 stars4 stars4 stars / 101
January 05, 2004
TABLE OF CONTENTS:
  1. · Creating an HTML File List with VB
  2. · Setting Up Your Program
  3. · Coding the Program
  4. · Opening the Dir.txt File and Creating the HTML File
  5. · Compiling the File and Wrapping Up

print this article
SEARCH DEVARTICLES

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


blog comments powered by Disqus
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

Watch our Tech Videos 
Dev Articles Forums 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
Contact Us 
Site Map 
Privacy Policy 
Support 

Developer Shed Affiliates

 




© 2003-2017 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap
Popular Web Development Topics
All Web Development Tutorials