指定した値をこのキーから削除します。
Overloads Public Sub DeleteValue( _
ByVal name As String _)
[C#]
public void DeleteValue(stringname);
[C++]
public: void DeleteValue(String* name);
[JScript]
public function DeleteValue(
name : String);
パラメータ
- name
削除する値の名前。
例外
例外の種類 | 条件 |
---|---|
ArgumentException | name が有効な値参照ではないか、または name が null 参照 (Visual Basic では Nothing) です。 |
SecurityException | このユーザーには、RegistryPermission.SetInclude(delete, currentKey) アクセス許可がありません。 |
ObjectDisposedException | 操作対象の RegistryKey が閉じています。閉じられたキーにはアクセスできません。 |
UnauthorizedAccessException | 操作しようとした RegistryKey が読み取り専用です。 |
使用例
[Visual Basic, C#, C++] 次のコード例は RegistryKey クラスの例の一部です。
' Delete the non-secure password value.
testSettings = test9999.OpenSubKey("TestSettings", True)
testSettings.DeleteValue("password")
' Verify the deletion.
Console.WriteLine(CType(testSettings.GetValue( _
"password", "Password not found."), String))
testSettings.Close()
[C#]
using(RegistryKey
testSettings = test9999.OpenSubKey("TestSettings", true))
{
// Delete the non-secure password value.
testSettings.DeleteValue("password");
// Verify the deletion.
Console.WriteLine((string)testSettings.GetValue(
"password", "Password not found."));
}
[C++]
// Delete the non-secure password value.
testSettings = test9999->OpenSubKey(S"TestSettings", true);
testSettings->DeleteValue(S"password");
// Verify the deletion.
Console::WriteLine(dynamic_cast<String*>(
testSettings->GetValue("password", S"Password not found.")));
testSettings->Close();
[JScript] JScript のサンプルはありません。Visual Basic、C#、および C++ のサンプルを表示するには、このページの左上隅にある言語のフィルタ ボタン をクリックします。
必要条件
プラットフォーム: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 ファミリ
.NET Framework セキュリティ:
- RegistryPermission (指定したレジストリ キーを削除するために必要なアクセス許可) Write (関連する列挙体)
参照
RegistryKey クラス | RegistryKey メンバ | Microsoft.Win32 名前空間 | RegistryKey.DeleteValue オーバーロードの一覧 | DeleteSubKey | OpenSubKey | GetValue | GetValueNames | ValueCount