469,643 Members | 1,918 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,643 developers. It's quick & easy.

HELP ! Populate text file from array

I have a text file being created and need the values from the array that
gets created to populate my text file. I am new and not very good. Kinda
borrowing bits and pieces from here and there, so if my code is a mess
(Which it is ) don't be alarmed.
Myfile is the array that gets populated and I need it's results returned
to the text file .

Below is the code...

Dim oFile As System.IO.File

Dim oWrite As System.IO.StreamWriter

Dim folderpath As String ' Path to users folders.

Dim dirpath, adir, sdir, testpath, myfile

Me.txt1.Text = "Starting search now."

Me.Button2.Text = "Running!"

oWrite = oFile.CreateText("C:\sample.txt") ' Creates the file to write
results to.

dirpath = "J:\" ' Sets the root Directory.
adir = Directory.GetDirectories(dirpath) 'Get the Directories under the root
of "Dirpath"

Try

For Each folderpath In adir

sdir = Path.GetFileName(folderpath) & "\Cookies" 'Sets the folder to look in
the cookies folder.

TESTPATH = (dirpath & sdir)

Me.txt1.Text = (sdir)

myfile = Directory.GetFiles(TESTPATH)

Debug.WriteLine(myfile)

oWrite.WriteLine(sdir, myfile)

Next

oWrite.Close()

MsgBox("Im done")

Catch ex As Exception

MessageBox.Show("ERROR: " & ex.ToString())

End Try

Me.Button2.Text = "Start!"
Nov 21 '05 #1
1 1264
Try taking a look at this...perhaps this will help you out...

http://www.microsoft.com/technet/scr.../mstxvb10.mspx
Nov 21 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Marcelo | last post: by
4 posts views Thread by Paul David Buchan | last post: by
reply views Thread by gheharukoh7 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.