Click here to Skip to main content
15,923,273 members
Home / Discussions / Visual Basic
   

Visual Basic

 
General"Specified Cast Not Valid" Pin
nvmoss5-Apr-04 5:41
nvmoss5-Apr-04 5:41 
QuestionHow to programatically create a text file containing the VB.Net code neccessary for recreating a different file programatically Pin
Codemonkey855-Apr-04 5:06
Codemonkey855-Apr-04 5:06 
AnswerRe: How to programatically create a text file containing the VB.Net code neccessary for recreating a different file programatically Pin
Nadroj5-Apr-04 7:23
Nadroj5-Apr-04 7:23 
GeneralRe: How to programatically create a text file containing the VB.Net code neccessary for recreating a different file programatically Pin
Codemonkey855-Apr-04 17:19
Codemonkey855-Apr-04 17:19 
GeneralRe: How to programatically create a text file containing the VB.Net code neccessary for recreating a different file programatically Pin
Nadroj5-Apr-04 18:52
Nadroj5-Apr-04 18:52 
GeneralRe: How to programatically create a text file containing the VB.Net code neccessary for recreating a different file programatically Pin
Codemonkey855-Apr-04 19:56
Codemonkey855-Apr-04 19:56 
GeneralRe: How to programatically create a text file containing the VB.Net code neccessary for recreating a different file programatically Pin
Nadroj5-Apr-04 20:08
Nadroj5-Apr-04 20:08 
GeneralRe: How to programatically create a text file containing the VB.Net code neccessary for recreating a different file programatically Pin
Nadroj5-Apr-04 20:15
Nadroj5-Apr-04 20:15 
ok.. is this more accurate:

ACTUAL CODE FOR SUB:
-------------------------------------------------------------------------------------------------------
Private Sub MakeFile(ByVal source As String, ByVal destination As String)
Dim inFile As StreamReader = File.OpenText(source)
Dim outFile As StreamWriter = File.CreateText(destination)

outfile.WriteLine("Private Sub MakeFile(ByVal source As String, ByVal destination As String)")
outfile.WriteLine("Dim inFile As StreamReader = File.OpenText(source)")
outFile.WriteLine("Dim outFile As StreamWriter = File.CreateText(destination)")
outFile.WriteLine()

Do Until inFile.Peek = -1
outFile.WriteLine("outFile.WriteLine(" & Chr(34) & inFile.ReadLine & Chr(34) & ")")
Loop

outFile.WriteLine()

outFile.WriteLine("outFile.Close()")
outFile.WriteLine("inFile.Close()")

outFile.WriteLine()

outFile.WriteLine("End Sub")

outFile.Close()
inFile.Close()

End Sub
-------------------------------------------------------------------------------------------------------


CONTENTS OF .txt FILE AFTER PROGRAM EXECUTED:
-------------------------------------------------------------------------------------------------------
Private Sub MakeFile(ByVal source As String, ByVal destination As String)
Dim inFile As StreamReader = File.OpenText(source)
Dim outFile As StreamWriter = File.CreateText(destination)

outFile.WriteLine("<html>")
outFile.WriteLine("<title>Heres my title</title>")
outFile.WriteLine("<body>")
outFile.WriteLine("<p>here is all my text for the web page.</p>")
outFile.WriteLine("</body>")
outFile.WriteLine("</html>")

outFile.Close()
inFile.Close()

End Sub
-------------------------------------------------------------------------------------------------------

for the .txt file part above (the outfile.writeline("<html>")) part), is that correct? or should it display the Do/Loop as shown at the top (in the actual sub's code), in place of all the 'outFile.WriteLine' commands with the html tags

------------------------
Jordan.
III
GeneralRe: How to programatically create a text file containing the VB.Net code neccessary for recreating a different file programatically Pin
Codemonkey855-Apr-04 21:52
Codemonkey855-Apr-04 21:52 
GeneralRe: How to programatically create a text file containing the VB.Net code neccessary for recreating a different file programatically Pin
Nadroj6-Apr-04 3:01
Nadroj6-Apr-04 3:01 
AnswerRe: How to programatically create a text file containing the VB.Net code neccessary for recreating a different file programatically Pin
Dave Kreskowiak6-Apr-04 0:56
mveDave Kreskowiak6-Apr-04 0:56 
GeneralRe: How to programatically create a text file containing the VB.Net code neccessary for recreating a different file programatically Pin
Codemonkey856-Apr-04 11:50
Codemonkey856-Apr-04 11:50 
GeneralRe: How to programatically create a text file containing the VB.Net code neccessary for recreating a different file programatically Pin
Nadroj6-Apr-04 11:52
Nadroj6-Apr-04 11:52 
GeneralRe: How to programatically create a text file containing the VB.Net code neccessary for recreating a different file programatically Pin
Codemonkey856-Apr-04 16:38
Codemonkey856-Apr-04 16:38 
GeneralSerializing Pin
Anonymous5-Apr-04 4:51
Anonymous5-Apr-04 4:51 
GeneralRe: Serializing Pin
Alberto Venditti5-Apr-04 21:12
Alberto Venditti5-Apr-04 21:12 
GeneralRe: Serializing Pin
Randy S6-Apr-04 15:01
Randy S6-Apr-04 15:01 
GeneralApplication with Socket Programming Pin
rajamca20034-Apr-04 20:39
rajamca20034-Apr-04 20:39 
GeneralRe: Application with Socket Programming Pin
adarsh_m4-Apr-04 23:44
adarsh_m4-Apr-04 23:44 
GeneralClickety Pin
Colin Angus Mackay5-Apr-04 0:22
Colin Angus Mackay5-Apr-04 0:22 
GeneralCopying a class (copy constructor) Pin
PaleyX4-Apr-04 12:29
PaleyX4-Apr-04 12:29 
GeneralRe: Copying a class (copy constructor) Pin
Dave Kreskowiak4-Apr-04 17:47
mveDave Kreskowiak4-Apr-04 17:47 
GeneralDependency problems in deploying a VB.Net Application Pin
nvmoss4-Apr-04 9:01
nvmoss4-Apr-04 9:01 
GeneralRe: Dependency problems in deploying a VB.Net Application Pin
Wayne Phipps4-Apr-04 9:08
Wayne Phipps4-Apr-04 9:08 
GeneralUsing NetworkStream Pin
Wayne Phipps4-Apr-04 8:02
Wayne Phipps4-Apr-04 8:02 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.