收到此错误An object reference is required for the non-static field, method, or property 'Microsoft.Win32.RegistryKey.SetValue(string, object)'
,我已从注册表中获取值并尝试使用以下代码使用新值更新它们,但它向我显示此错误,我哪里出错了?
private void button2_Click(object sender, EventArgs e)
{
txtEmailID.Enabled = true;
string eid = txtEmailID.Text;
RegistryKey key = Registry.ClassesRoot;
RegistryKey registryKey = Registry.CurrentUser.OpenSubKey(@"Software\StudentExam\Protection", true);
RegistryKey.SetValue("EmailID", eid);//Error at this Line
}