Clear Method

Applies to TestComplete 15.40, last modified on July 05, 2022

Description

Use the Clear method to remove all subsections and options of the current section. The method will not remove the section.

Declaration

ProgObj.Clear()

ProgObj An expression, variable or parameter that specifies a reference to one of the objects listed in the Applies To section
Result None

Applies To

The method is applied to the following objects:

Result Value

None.

Remarks

Be careful when modifying the system registry using the Section object methods. Incorrect modifications made to the registry may affect the functionality of your operating system and the applications installed.

Example

The following code snippet deletes the specified registry key.

JavaScript, JScript

function Test()
{
  var Key;
  // Gets an object for the Windows system registry key and deletes the key
  Key = Storages.Registry("TestKey\\SubKey", HKEY_CURRENT_USER)
  // Deletes the key
  Key.Clear();
}

Python

def Test():
  # Gets an object for the Windows system registry key and deletes the key
  Key = Storages.Registry("TestKey\\SubKey", HKEY_CURRENT_USER)
  # Deletes the key
  Key.Clear()

VBScript

Sub Test
  Dim Key
  ' Gets an object for the Windows system registry key and deletes the key
  Set Key = Storages.Registry("TestKey\SubKey", HKEY_CURRENT_USER)
  ' Deletes the key
  Key.Clear
End Sub

DelphiScript

procedure Test();
var Key;
begin
  // Gets an object for the Windows system registry key and deletes the key
  Key := Storages.Registry('TestKey\SubKey', HKEY_CURRENT_USER);
  // Deletes the key
  Key.Clear;
end;

C++Script, C#Script

function Test()
{
  var Key;
  // Gets an object for the Windows system registry key and deletes the key
  Key = Storages["Registry"]("TestKey\\SubKey", HKEY_CURRENT_USER)
  // Deletes the key
  Key["Clear"]();
}

See Also

DeleteSubSection Method
DeleteSubSectionByIndex Method

Highlight search results