ArcObjects Component Help  (Core)    

IClassSchemaEdit Example

The following example shows how you can use the IClassSchemaEdit interface to alter the COM class extension for an object class.

   ' open the workspace
   Dim pWSF As IWorkspaceFactory
   Set pWSF = New AccessWorkspaceFactory
   
   Dim pWS As IWorkspace
   Set pWS = pWSF.OpenFromFile("d:\working\arckansas\data\access\testclsext2.mdb", 0)
   
   ' QI for IFeatureWorkspace
   Dim pFeatWS As IFeatureWorkspace
   Set pFeatWS = pWS
   
   ' open the object class whose class schema you want to modify
   Dim pOc As IObjectClass
   Dim pTab As ITable
   Set pTab = pFeatWS.OpenFeatureClass("buildings")
   Set pOc = pTab
   
   ' QI for the IClassSchemEdit interface
   Dim pOcSchemaEdit As IClassSchemaEdit
   Set pOcSchemaEdit = pOc
   
   ' set an exclusive lock on the class
   Dim pSchLock As ISchemaLock
   Set pSchLock = pOc
   pSchLock.ChangeSchemaLock (esriExclusiveSchemaLock)
   
   ' create the IUID object
   Dim pCUID As IUID
   Set pCUID = New UID
   pCUID.Value = "{484F435C-9A08-11D3-815A-0080C78E8371}"
   
   ' alter the class extension for the class
   pOcSchemaEdit.AlterClassExtensionCLSID pCUID, Nothing
 
   ' release the exclusive lock
   pSchLock.ChangeSchemaLock (esriSharedSchemaLock)
  
 

[Visual Basic .NET, C#, C++]
No example is available for Visual Basic .NET, C#, or C++. To view a Visual Basic 6.0 example, click the Language Filter button Language Filter in the upper-left corner of the page.