Hello,
I need to create a piece of code that using IMetadatawindow show the metadata of mxd files. I know already how to do this for layers but I can not find a way to do it for mxd's.
here is the code I use to show metadata of layers which work perfect.
Private Sub TSBtn_metadata_Click(sender As System.Object, e As System.EventArgs) Handles TSBtn_metadata.Click
Dim _path As String = TreeViewMS1.SelectedNode.Tag
Dim m_fso As Object = CreateObject("Scripting.FileSystemObject")
Dim m_GxFile As ESRI.ArcGIS.Catalog.IGxFile = New GxFile
Dim m_GxFolder As ESRI.ArcGIS.Catalog.IGxFile = New GxFolder
Dim pLayer As ILayer
Dim pGxFile As ESRI.ArcGIS.Catalog.IGxFile
Dim pGxlayer As ESRI.ArcGIS.Catalog.IGxLayer = New GxLayer
If m_fso.FolderExists(_path) Then
pGxFile = m_GxFolder
ElseIf m_fso.FileExists(_path) Then
pGxFile = m_GxFile
Else
MsgBox("No metadata for " & _path)
Exit Sub
End If
pGxFile = CType(pGxlayer, ESRI.ArcGIS.Catalog.IGxFile)
pGxFile.Path = _path
pLayer = pGxlayer.Layer
Dim pMd As IMetadataViewWindow
pMd = New MetadataViewWindow
pMd.Layer = pLayer
pMd.Application = modMain.App
Dim pDLayer As IDataLayer
pDLayer = pLayer
Dim pName As IName
pName = pDLayer.DataSourceName
Dim pDatasetName As IDatasetName
pDatasetName = pName
pMd.DataSource = pDatasetName
pMd.Show(True)
End Sub
any help is really appreciated.
thanks.
I need to create a piece of code that using IMetadatawindow show the metadata of mxd files. I know already how to do this for layers but I can not find a way to do it for mxd's.
here is the code I use to show metadata of layers which work perfect.
Private Sub TSBtn_metadata_Click(sender As System.Object, e As System.EventArgs) Handles TSBtn_metadata.Click
Dim _path As String = TreeViewMS1.SelectedNode.Tag
Dim m_fso As Object = CreateObject("Scripting.FileSystemObject")
Dim m_GxFile As ESRI.ArcGIS.Catalog.IGxFile = New GxFile
Dim m_GxFolder As ESRI.ArcGIS.Catalog.IGxFile = New GxFolder
Dim pLayer As ILayer
Dim pGxFile As ESRI.ArcGIS.Catalog.IGxFile
Dim pGxlayer As ESRI.ArcGIS.Catalog.IGxLayer = New GxLayer
If m_fso.FolderExists(_path) Then
pGxFile = m_GxFolder
ElseIf m_fso.FileExists(_path) Then
pGxFile = m_GxFile
Else
MsgBox("No metadata for " & _path)
Exit Sub
End If
pGxFile = CType(pGxlayer, ESRI.ArcGIS.Catalog.IGxFile)
pGxFile.Path = _path
pLayer = pGxlayer.Layer
Dim pMd As IMetadataViewWindow
pMd = New MetadataViewWindow
pMd.Layer = pLayer
pMd.Application = modMain.App
Dim pDLayer As IDataLayer
pDLayer = pLayer
Dim pName As IName
pName = pDLayer.DataSourceName
Dim pDatasetName As IDatasetName
pDatasetName = pName
pMd.DataSource = pDatasetName
pMd.Show(True)
End Sub
any help is really appreciated.
thanks.