Hyperlink snippet example

Discussion created by amgarci145 on Nov 22, 2011
Latest reply on Nov 25, 2011 by amgarci145

I am new to working with ArcObjects specifically using code.

I have placed a command button on a form.  When one clicks the button it should open the URL.
I have placed the VB.Net AddHyperlink snippet example, but I am not sure how to call the code with the button click event?  In addition, not sure where to place the URL? I know it???s a strLink, but how do you call it.

For example on Form1 I have this hyperlink snippet code:

'<summary>Adds a hyperlink to a selected features in an IFeatureLayer.</summary>
'<param name="activeView">An IActiveView interface</param>
'<param name="strLink">A System.String that is the web site to link to. Example: ""</param>
'<param name="featurelayer">An IFeatureLayer interface to which to create the hyperlink for</param>
'<remarks>It is expected that you have features in the IFeatureLayer already selected before calling this routine.</remarks>

Public Sub AddHyperlink(ByVal activeView As ESRI.ArcGIS.Carto.IActiveView, ByVal strLink As System.String, ByVal featureLayer As ESRI.ArcGIS.Carto.IFeatureLayer)
If activeView Is Nothing OrElse strLink Is Nothing Or Else featureLayer Is Nothing Then
End If

  Dim map As ESRI.ArcGIS.Carto.IMap = activeView.FocusMap
  Dim enumFeature As ESRI.ArcGIS.Geodatabase.IEnumFeature =   TryCast(map.FeatureSelection, 
  ESRI.ArcGIS.Geodatabase.IEnumFeature) ' Dynamic Cast
  Dim feature As ESRI.ArcGIS.Geodatabase.IFeature = enumFeature.Next

Do While Not feature Is Nothing
    Dim hyperlink As ESRI.ArcGIS.Carto.IHyperlink = New     
    hyperlink.LinkType =
    hyperlink.Link = strLink
    hyperlink.FeatureId = feature.OID
    Dim hyperlinkContainer As ESRI.ArcGIS.Carto.IHyperlinkContainer = CType(featureLayer, 
    ESRI.ArcGIS.Carto.IHyperlinkContainer)' Eplicit Cast
    feature = enumFeature.Next

End Sub

These references were added

In the button click event I  try to call the hyperlink
call AddHyperlink()

of course nothing happens.

Can someone help me get this code working,so I can see how the hyperlink snippet code works for

Thank You