Reputation: 61
I want to append some texts in a file.
I used this code to append text from a file
Dim Lines As List(Of String) = ReadAllLines(Script_Path_DiskPart & File_MakeVDISK).ToList()
Lines.Insert(0, Frm_Login.AmountDisk & " Type=" & ChrW(34) & "EXPANDABLE" & ChrW(34))
System.IO.File.WriteAllLines(Script_Path_DiskPart & File_MakeVDISK, Lines)
And this is what I get after System.File.WriteAllLines(Script_Path_Diskpart & File_MakeVDISK, Lines)
Unexpected result:
Expected result:
Actually I want to use System.IO.File.Append...
but I don't know how it works...
Upvotes: 0
Views: 794
Reputation: 2474
It looks like instead of the Lines.Insert
statement, you want to do something like this:
Lines(0) = Lines(0) & Frm_Login.AmountDisk & " Type=""EXPANDABLE"""
Note that you can escape a quote mark with another quote mark, instead of using the ChrW
, hence the pair of doubled quotes ""
around "EXPANDABLE".
Upvotes: 1