How can i refill a textbox with it’s previous text after the program was stopped using registry.
I read multiple articles like:
So far i have nothing because nothing is working out, all i get are errors D:
public string Read(string KeyName)
{
RegistryKey rk = baseRegistryKey ;
RegistryKey sk1 = rk.OpenSubKey(subKey);
if ( sk1 == null )
return null;
else
{
try
{
return (string)sk1.GetValue(KeyName.ToUpper());
}
catch (Exception ex)
{
}
}
}
says that baseRegistryKey and subKey don’t exist. And it says that RegistryKey doesn’t exist. How do i fix?
I’ve had the same problem a couple of days ago, don’t use those sights, they are all bad.
there are several things wrong with your code:
using Microsoft.Win32The code i used to solve this was:
and then where ever you have ex:
textbox1.text = Path.GetDirectoryName(saveFileDialoge1.FileName);, under it you postApplication.UserAppDataRegistry.SetValue("example", textbox1.text);