Reputation: 4088
how would I edit a string in the resources of my project? I get this error when I try it:
Property or indexer 'Project.Properties.Resources.ExternalIp' cannot be assigned to -- it is read only
This is what I do:
Resources.ExternalIp = utf8.GetString(webClient.DownloadData("http://automation.whatismyip.com/n09230945.asp"));
Upvotes: 0
Views: 2907
Reputation: 2151
Properties.Ressources
are readonly ("compiled"), you have to use Properties.Settings
& put the Scope to "User" so it will be 'ReadWrite'
Project.Properties.Settings.Default.ExternalIp = utf8.GetString(webClient.DownloadData("http://automation.whatismyip.com/n09230945.asp"));
Project.Properties.Settings.Default.Save();
Upvotes: 5
Reputation: 292465
Resources are not supposed to be written to; they're embedded in the executable, so changing them would involve modifying the executable.
From your code, it looks like you actually need application settings, not resources.
Upvotes: 4