Hello - I'm a VB.NET novice and I'm making a little program that allows you to select a number of HTML files and it will go through and replace internet addresses with hyperlinks.
I am very close to getting it done, but I am totally confused on how to write the marked-up text to a file. I have the text in a variable, so it's just a matter of writing it at this point.
Here's my code:
So - What I want is to write strOutStream to a text file and name the file i (i = the file that was opened) & "_PARSED".
I messed around with StreamWriter and I was able to create the file w/ the name I want but it was 0 bytes long (aka empty). I'm messing something up in getting the string to the stream.
Can anyone help me to write strOutStream to a text file and name it like I was doing?
Thanks again - I'm excited because this little proggy will make my life alot easier and it's my first totally-from-scratch creation that has a useful purpose.
Also - Any comments are welcomed in syntax / neat code, etc..
I am very close to getting it done, but I am totally confused on how to write the marked-up text to a file. I have the text in a variable, so it's just a matter of writing it at this point.
Here's my code:
Code:
Private Sub btnAddFiles_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnAddFiles.Click
Dim sReader As System.IO.StreamReader
Dim arFiles As Array
Dim strFileNames, strInStream, strOutStream As String
Dim i As String
diaOpenFile.ShowDialog()
arFiles = diaOpenFile.FileNames
For Each i In arFiles
txtFileNames.Text = i ' to show me the file name(s) for testing
sReader = New System.IO.StreamReader(i)
strInStream = sReader.ReadToEnd
strOutStream = InsertHyperlinks(strInStream)
txtContents.Text = strOutStream ' to show me the output in a text box for testing
' Now What? I need to write to a file..
Next
End Sub
So - What I want is to write strOutStream to a text file and name the file i (i = the file that was opened) & "_PARSED".
I messed around with StreamWriter and I was able to create the file w/ the name I want but it was 0 bytes long (aka empty). I'm messing something up in getting the string to the stream.
Can anyone help me to write strOutStream to a text file and name it like I was doing?
Thanks again - I'm excited because this little proggy will make my life alot easier and it's my first totally-from-scratch creation that has a useful purpose.
Also - Any comments are welcomed in syntax / neat code, etc..