The Cache: Technology Expert's Forum
 
*
Welcome, Guest. Please login or register. February 11, 2012, 11:22:19 PM

Login with username, password and session length


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

Posts: 18


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

No links in signatures please
tomt
Rookie
**
Offline Offline

Posts: 18


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

No links in signatures please
perkiset
Olde World Hacker
Administrator
Lifer
*****
Online Online

Posts: 9792



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

It is now believed, that after having lived in one compound with 3 wives and never leaving the house for 5 years, Bin Laden called the U.S. Navy Seals himself.
tomt
Rookie
**
Offline Offline

Posts: 18


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

Shawn is more into game programming.

Tom
Logged

No links in signatures please
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!