[thelist] Free tip

David.Cantrell at Gunter.AF.mil David.Cantrell at Gunter.AF.mil
Fri Mar 7 13:33:00 CST 2003


--
[ Picked text/plain from multipart/alternative ]
I've been very lax on this and probably owe a few tips, so here's one on
.NET registry access I just figured out:

<tip type="Setting registry values in .NET" author="Dave Cantrell">
The .NET SDK is very sparse when it comes to code examples for reading from
and writing to the system registry. If you aren't careful about how you open
registry keys, you will run into a System.UnauthorizedAccessException if you
try to write to them. All it takes is a boolean flag to enable writing:

  Dim key As RegistryKey =
Registry.CurrentUser.OpenSubKey("Software\Microsoft\Windows\CurrentVersion\I
nternet Settings", True)
  key.SetValue("ProxyServer", "localhost:8080")

Be sure to import the Microsoft.Win32 namespace first.
</tip>



More information about the thelist mailing list