Answer the question
In order to leave comments, you need to log in
C#. How to get value from registry?
Good afternoon.
I'm trying to get a value from the registry in a Windows Forms project.
But I am getting errors. Tell me what did you do wrong?
And how to assign label1 as a result?
public MainForm()
{
//
// The InitializeComponent() call is required for Windows Forms designer support.
//
InitializeComponent();
RegistryKey readKey = Registry.CurrentUser.OpenSubKey("\\Software\\Microsoft\\Internet Explorer\\Main\\FeatureControl\\FEATURE_BROWSER_EMULATION");
string loadString = (string)readKey.GetValue("devenv.exe");
readKey.Close();
//
// TODO: Add constructor code after the InitializeComponent() call.
//
}
System.NullReferenceException: Ссылка на объект не указывает на экземпляр объекта.
в tttosto.MainForm..ctor() в c:\User\Documents\SharpDevelop Projects\tttosto\tttosto\MainForm.cs:строка 29
в tttosto.Program.Main(String[] args) в c:\User\Documents\SharpDevelop Projects\tttosto\tttosto\Program.cs:строка 27
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question