ArcObjects Library Reference

Add Hotlink Snippet

Adds a hotlink for the specified field in an IFeatureLayer.

[C#]

///<summary>Adds a hotlink for the specified field in an IFeatureLayer.</summary>
///      
///<param name="hotlinkField">A System.String that is the name of the field that contains the hotlink URL's of the web site to link to. Example: "URLfield"</param>
///<param name="featureLayer">An IFeatureLayer interface</param>
///      
///<remarks></remarks>
public void AddHotlink(System.String hotlinkField, ESRI.ArcGIS.Carto.IFeatureLayer featureLayer)
{
  if(hotlinkField == null || featureLayer == null)
  {
    return;
  }
  ESRI.ArcGIS.Carto.IHotlinkContainer hotlinkContainer = featureLayer as ESRI.ArcGIS.Carto.IHotlinkContainer; // Dynamic Cast
  hotlinkContainer.HotlinkField = hotlinkField;
  hotlinkContainer.HotlinkType = ESRI.ArcGIS.Carto.esriHyperlinkType.esriHyperlinkTypeURL;
}
[Visual Basic .NET]

'''<summary>Adds a hotlink for the specified field in an IFeatureLayer.</summary>
'''      
'''<param name="hotlinkField">A System.String that is the name of the field that contains the hotlink URL's of the web site to link to. Example: "URLfield"</param>
'''<param name="featureLayer">An IFeatureLayer interface</param>
'''      
'''<remarks></remarks>
Public Sub AddHotlink(ByVal hotlinkField As System.String, ByVal featureLayer As ESRI.ArcGIS.Carto.IFeatureLayer)

  If hotlinkField Is Nothing OrElse featureLayer Is Nothing Then

    Return

  End If

  Dim hotlinkContainer As ESRI.ArcGIS.Carto.IHotlinkContainer = TryCast(featureLayer, ESRI.ArcGIS.Carto.IHotlinkContainer) ' Dynamic Cast
  hotlinkContainer.HotlinkField = hotlinkField
  hotlinkContainer.HotlinkType = ESRI.ArcGIS.Carto.esriHyperlinkType.esriHyperlinkTypeURL

End Sub


Additional Requirements
  • The code in this document requires the following References added to the Visual Studio project:
  • ESRI.ArcGIS.Carto