ISPatientProblem.DeleteRegistryKey

Description

This function deletes the selected registry key of the patient's problem.

Syntax

object.DeleteRegistryKey aRegistryKey

Part Attribute Type Description
object Required
The object always implements the ISPatientProblem interface
aRegistryKey In, Required
The registry key to delete

Example

Display the registry keys of the patient's problem before and after deleting one of them.

sub main()

  Dim aTrans
  Dim aPatient  
  Dim aProblemList, aProblem
  Dim aNewRegKey
  Dim aRegistryKeys, aRegistryKey
  Dim aMessage

  Set aTrans = Profile.StartMapTransaction

  set aPatient = Profile.SelectPatient 
  set aProblemList = aPatient.ProblemList

  if aProblemList.Count = 0 then
    Profile.MsgBox("The patient has no problems")
    exit sub
  end if

  set aProblem = aProblemList.Item(0)


  aMessage = "THE STATE BEFORE THE CHANGES:" & vbNewLine &_
    GetPatientProblemRegistryKeyInfo(aProblem.GUID)

  set aNewRegKey = aProblem.AddRegistryKey("REGPROBLEM1", "NewRegKey_1")
  
  if aNewRegKey is nothing then 
    Profile.MsgBox("No registry key with the specified code")
    exit sub
  end if

  aProblem.Save
  aTrans.SnapShot

  aMessage = aMessage & vbNewLine & "THE STATE AFTER ADDING REG KEY:" & vbNewLine &_
    GetPatientProblemRegistryKeyInfo(aProblem.GUID)

  aProblem.DeleteRegistryKey(aNewRegKey)
  aProblem.Save
  aTrans.SnapShot

  aMessage = aMessage & vbNewLine & "THE STATE AFTER DELETING REG KEY:" & vbNewLine &_
    GetPatientProblemRegistryKeyInfo(aProblem.GUID)

  Profile.MsgBox(aMessage)

end sub

function GetPatientProblemRegistryKeyInfo(aProblemGUID)
  Dim aTrans
  Dim aProblem
  Dim aRegistryKeys
  Dim aRegistryKey
  Dim aMessage
  
  set aTrans = Profile.StartMapTransaction
  set aProblem = Profile.LoadPatientProblemByGUID(aProblemGUID) 
  set aRegistryKeys = aProblem.GetRegistryKeys
  aMessage = "Registry Keys Count = " & aRegistryKeys.Count & vbNewLine

  for i = 0 to aRegistryKeys.Count - 1
    set aRegistryKey = aRegistryKeys.Item(i)
    aMessage = aMessage & "     '" & aRegistryKey.KeyCode.Description & "' = '" &_ 
    aRegistryKey.KeyValue & "'" & vbNewLine 
  next
  GetPatientProblemRegistryKeyInfo = aMessage
end function  
Note:

In Profile Client v8 on User Interface Registry Key cannot be found.

See also

Version information

Added in v8.2.0