Leadtools.Forms.Auto Requires Document/Medical product license | Send comments on this topic. | Back to Introduction - All Topics | Help Version 16.5.9.25
DeleteChildCategory Method
See Also  Example
Leadtools.Forms.Auto Namespace > DiskMasterFormsCategory Class : DeleteChildCategory Method



category
The category object to be deleted.
category
The category object to be deleted.
Removes the first appearance of the specified category object from ChildCategories and deletes it from the local disk.

Syntax

Visual Basic (Declaration) 
Public Overridable Sub DeleteChildCategory( _
   ByVal category As IMasterFormsCategory _
) 
Visual Basic (Usage)Copy Code
Dim instance As DiskMasterFormsCategory
Dim category As IMasterFormsCategory
 
instance.DeleteChildCategory(category)
C# 
public virtual void DeleteChildCategory( 
   IMasterFormsCategory category
)
C++/CLI 
public:
virtual void DeleteChildCategory( 
   IMasterFormsCategory^ category
) 

Parameters

category
The category object to be deleted.

Example

//

Visual BasicCopy Code
Public Sub AutoFormsDeleteCategory(ByVal repository As DiskMasterFormsRepository, ByVal name As String)
   DeleteCategory(repository.RootCategory, name)
End Sub
Private Sub DeleteCategory(ByVal category As IMasterFormsCategory, ByVal name As String)
   If category.Name = name AndAlso Not category.Parent Is Nothing Then
      category.Parent.DeleteChildCategory(category)
   End If
   For Each childCategory As IMasterFormsCategory In category.ChildCategories
      DeleteCategory(childCategory, name)
   Next childCategory
End Sub
C#Copy Code
public void AutoFormsDeleteCategory(DiskMasterFormsRepository repository, string name) 

   DeleteCategory(repository.RootCategory, name); 

 
public void DeleteCategory(IMasterFormsCategory category, string name) 

   if(category.Name == name && category.Parent != null) 
      category.Parent.DeleteChildCategory(category); 
   foreach(IMasterFormsCategory childCategory in category.ChildCategories) 
   { 
      DeleteCategory(childCategory, name); 
   } 
}

Remarks

The source code of this interface implementation class is available at <Install Directory>\Examples\DotNet\CS\AutoMasterFormsRepository.

The category directory will be deleted and cannot be restored. If the user wants to do different action he can inherit this class and override this method or do a custom implementation of IMasterFormsCategory. Be advised to have a back up copy of all Master Forms if this used this class, in case you have deleted the wrong Category.

There is no need to call DiskMasterFormsRepository.Refresh since the repository that this category belongs will be updated with this deletion.

Requirements

Target Platforms: Microsoft .NET Framework 3.0, Windows XP, Windows Server 2003 family, Windows Server 2008 family

See Also

Leadtools.Forms requires a Forms Module license and unlock key. For more information, refer to: Imaging Pro/Document/Medical Features