<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: VBA Code to VB.NET in ArcObjects SDK Questions</title>
    <link>https://community.esri.com/t5/arcobjects-sdk-questions/vba-code-to-vb-net/m-p/414671#M11139</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;A href="http://resources.esri.com/arcgisdesktop/dotnet/index.cfm"&gt;http://resources.esri.com/arcgisdesktop/dotnet/index.cfm&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Has walk-thru's and just about everything you'll need to get going.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Good Luck!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 22 May 2010 12:43:34 GMT</pubDate>
    <dc:creator>JamesCrandall</dc:creator>
    <dc:date>2010-05-22T12:43:34Z</dc:date>
    <item>
      <title>VBA Code to VB.NET</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/vba-code-to-vb-net/m-p/414670#M11138</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi, I currently have the codes below for ArcGIS VBA. When the button is clicked, a label would be added to the selected feature. Specifically a country name would be added to the world map. However, I have limited knowledge working with Visual Studio 2008, and I was asked to convert these codes into working codes for Visual Studio 2008. I know that it will not work if I just copy and paste it.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Any help would be great. Thanks&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Private Sub UIButtonControl3_Click()&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;'Get the focus map&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Dim pDoc As IMxDocument&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Set pDoc = ThisDocument&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Dim pMap As IMap&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Set pMap = pDoc.FocusMap&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;' Get the selected layer&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Dim pLayer As IGeoFeatureLayer&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Set pLayer = pDoc.SelectedLayer&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;' Make sure a layer was selected&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; If pLayer Is Nothing Then&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; MsgBox "You must select a Layer to Label"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Exit Sub&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; End If&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;' Get the feature class to get the correct&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;' oid field name for the data type (oid,fid,objectid)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Dim pFc As IFeatureClass&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Dim strOIDName As String&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Set pFc = pLayer.FeatureClass&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;strOIDName = pFc.OIDFieldName&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;' Get the selected features from the layer&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Dim pFSel As IFeatureSelection&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Set pFSel = pLayer&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Dim pSelSet As ISelectionSet&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Set pSelSet = pFSel.SelectionSet&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Dim pFCur As IFeatureCursor&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;pSelSet.Search Nothing, False, pFCur&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;' Loop through the selected features and create a label&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;' expression for the selected features&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Dim pFeat As IFeature&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Dim strSql As String&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Set pFeat = pFCur.NextFeature&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; Do While Not pFeat Is Nothing&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; If strSql = "" Then&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; strSql = strOIDName &amp;amp; " = " &amp;amp; pFeat.OID&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Else&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; strSql = strSql &amp;amp; " or " &amp;amp; strOIDName &amp;amp; " = " &amp;amp; pFeat.OID&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; End If&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Set pFeat = pFCur.NextFeature&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; Loop&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Debug.Print strSql&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;' Get AnnotateLayerPropertiesCollection from layer&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Dim pAnnoLayerPropsColl As IAnnotateLayerPropertiesCollection&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Set pAnnoLayerPropsColl = pLayer.AnnotationProperties&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Dim pAnnoLayerProps As IAnnotateLayerProperties&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;pAnnoLayerPropsColl.QueryItem 0, pAnnoLayerProps, Nothing, Nothing&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;pAnnoLayerProps.Class = "LabelSel"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;pAnnoLayerProps.WhereClause = strSql&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;' Display the lables&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;pLayer.DisplayAnnotation = True&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;' Refresh the Data Frame&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;pDoc.ActiveView.Refresh&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;End Sub&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 21 May 2010 21:12:44 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/vba-code-to-vb-net/m-p/414670#M11138</guid>
      <dc:creator>KavinLai</dc:creator>
      <dc:date>2010-05-21T21:12:44Z</dc:date>
    </item>
    <item>
      <title>Re: VBA Code to VB.NET</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/vba-code-to-vb-net/m-p/414671#M11139</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;A href="http://resources.esri.com/arcgisdesktop/dotnet/index.cfm"&gt;http://resources.esri.com/arcgisdesktop/dotnet/index.cfm&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Has walk-thru's and just about everything you'll need to get going.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Good Luck!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 22 May 2010 12:43:34 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/vba-code-to-vb-net/m-p/414671#M11139</guid>
      <dc:creator>JamesCrandall</dc:creator>
      <dc:date>2010-05-22T12:43:34Z</dc:date>
    </item>
  </channel>
</rss>

