Solved

Not declared

Posted on 2006-07-21
2
221 Views
Last Modified: 2010-04-23
Hi,

I get the following error about not being declared;

lstFilesFound

on line that reads

lstFilesFound.Add(f)

Here is the code...

Public Class Form1
    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

        searchFiles()

    End Sub

    Private Sub searchFiles()
        Try
            Dim drives() As String
            Dim rootfolders() As String
            Dim d As String
            Dim f As String
            drives = System.IO.Directory.GetLogicalDrives()
            For drivecount As Integer = 0 To drives.Length - 1
                rootfolders = System.IO.Directory.GetDirectories(drives(drivecount))
                For rootFolderCount As Integer = 0 To rootfolders.Length - 1
                    DirSearch(rootfolders(rootFolderCount))
                Next
            Next
        Catch ex As Exception

        End Try
    End Sub

    Sub DirSearch(ByVal sDir As String)
        Dim d As String
        Dim f As String
        Try
            For Each d In System.IO.Directory.GetDirectories(sDir)
                For Each f In System.IO.Directory.GetFiles(d, "*.Txt")
                    lstFilesFound.Add(f)
                Next
                DirSearch(d)
            Next
        Catch excpt As System.Exception
            Debug.WriteLine(excpt.Message)
        End Try
    End Sub
End Class
0
Comment
Question by:nickmarshall
  • 2
2 Comments
 
LVL 23

Expert Comment

by:apresto
Comment Utility
Hi nickmarshall,

You havent declared lstFilesFound, what should it be, an arraylist?

if so add it at the top where you have the other DIM lines, Dim lstFilesFound as ArrayList or something similar

Apresto
0
 
LVL 23

Accepted Solution

by:
apresto earned 125 total points
Comment Utility
>>>lstFilesFound

unless its a control on your form, like a list box or something, make sure you have declared it in the class, just do Alt + f for 'lstFilesFound'
0

Featured Post

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Since .Net 2.0, Visual Basic has made it easy to create a splash screen and set it via the "Splash Screen" drop down in the Project Properties.  A splash screen set in this manner is automatically created, displayed and closed by the framework itsel…
Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now