ArcObjects Library Reference  (Carto)    

Toggle MapServerSubLayer Visibility

[Visual Basic 6.0]

  'Create new layer
  Set pMSLayer = New MapServerLayer
  pMSLayer.ServerConnect pSOName, pMapServer.DefaultMapName

  'QI ICompositeLayer in order to access MapServerSubLayers
  Dim pCompLayer As ICompositeLayer
  Set pCompLayer = pMSLayer
  MsgBox "ICompositeLayer: Count: " & pCompLayer.Count

  'Select specified MapServerSubLayer
  Dim i As Long
  i = 0

  Dim pMSSublayer As IMapServerSublayer
  Set pMSSublayer = pCompLayer.Layer(i)

  'QI
  Dim pLayer As ILayer
  Set pLayer = pMSSublayer

  'Change Visibility
  If pLayer.Visible = True Then
    pLayer.Visible = False


[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.