Click here to Skip to main content
15,887,135 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have created a text file added to resources in vb.net

I can save textfile data to a file in vb.net if the file is available in the disk.
But I am not able to write the code to write the content of textbox to file that is available in resources

What I have tried:

Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim FILE_NAME As String = "My.Resources.myfile.txt" ' "C:\myfile.txt"
If System.IO.File.Exists(FILE_NAME) = True Then
Dim objWriter As New System.IO.StreamWriter(FILE_NAME)
objWriter.Write(TextBox1.Text)
objWriter.Close()
MsgBox("Text written to file")
Else
MsgBox("File Does Not Exist")
End If
End Sub
End Class
Posted
Updated 8-Mar-20 17:23pm

1 solution

That's because resources are readonly. You cannot modify anything in resource.

Any .EXE you have running, and any .DLL's loaded into a process are locked. You cannot modify them while they are running.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900