The Cache: Technology Expert's Forum
 
*
Welcome, Guest. Please login or register. January 07, 2009, 11:17:49 PM

Login with username, password and session length


Pages: [1]
  Print  
Author Topic: convert vbscript to vb.net  (Read 650 times)
tomt
n00b
*
Offline Offline

Posts: 9


View Profile
« on: October 19, 2007, 12:22:16 PM »

I have the following vbscript that works if I place the script inside the directory folder of text files and run it from there. It merges all text files into one text file.

Set fso = CreateObject("Scripting.FileSystemObject")
set mainfolder=fso.GetFolder(".")
Set filecollection = mainfolder.Files


Set objfileOut=fso.OpenTextFile ("merged.txt",2,true)
init=false


For Each fileList In filecollection
   If fso.GetExtensionName(fileList.Path)="txt" Then
    Set objfileRead=fileList.OpenAsTextStream(1)
    objfileOut.Write   VBCRLF & "<file>" & VBCRLF
    objfileOut.Write  "<filename>" & fileList.name & "</filename>" & VBCRLF
    objfileOut.Write   VBCRLF & "<article>" & VBCRLF
    objfileOut.Write objfileRead.ReadAll
    objfileOut.Write   VBCRLF & "</article>" & VBCRLF
    objfileOut.Write   VBCRLF & "</file>" & VBCRLF
    objfileRead.Close
   End If
Next

I am trying to make a windows form in vb.net to do the same thing. I am using FolderBrowserDialog to get the directory folder. I can't get the vbscript converted correctly. Any help would be appreciated.

Thanks,
Tom
Logged
tomt
n00b
*
Offline Offline

Posts: 9


View Profile
« Reply #1 on: October 20, 2007, 08:31:53 AM »

Update.

Between my son, who knows vb.net 100 times better than me, and Google, I got the code rewrote and it works.

Tom



Logged
perkiset
Olde World Hacker
Administrator
Lifer
*****
Online Online

Posts: 5324


:sniffle: Humor was so much easier before.


View Profile
« Reply #2 on: October 20, 2007, 12:11:38 PM »

Right on... and what a cool and humorous place to resource.

Please invite your son to join us here ... Wink

/p
Logged

If I can't be Mr. Root then I don't want to play.
tomt
n00b
*
Offline Offline

Posts: 9


View Profile
« Reply #3 on: October 22, 2007, 06:44:48 PM »

Shawn is more into game programming.

Tom
Logged
Pages: [1]
  Print  
 
Jump to:  

Perkiset's Place Home   Best of The Cache   phpMyIDE: MySQL Stored Procedures, Functions & Triggers
Politics @ Perkiset's   Pinkhat's Perspective   
cache
mart
coder
programmers
ajax
php
javascript
Powered by MySQL Powered by PHP Powered by SMF 1.1.2 | SMF © 2006-2007, Simple Machines LLC
Seo4Smf v0.2 © Webmaster's Talks


Valid XHTML 1.0! Valid CSS!