<?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 Using a FeatureCursor with ISelectionSet.Search with Option Strict On in ArcObjects SDK Questions</title>
    <link>https://community.esri.com/t5/arcobjects-sdk-questions/using-a-featurecursor-with-iselectionset-search/m-p/123508#M3262</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi everyone,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I'm having this problem when I try to convert this simple Function from VBA to VB.Net with The "&lt;/SPAN&gt;&lt;STRONG&gt;Option Strict On&lt;/STRONG&gt;&lt;SPAN&gt;"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I Wish to use a FeatureCursor to retreive all the Features selected in a FeatureLayer.&amp;nbsp; In VBA, we were able to pass a FeatureCursor to the Search Method of ISelectionSet.&amp;nbsp; In .Net, with Option Strict On, this is not possible anymore.&amp;nbsp; We have to pass a Cursor (otherwise a CType conversion will be requiered, wich won't work anyway!)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;So my question is how do I access the Feature if I can only use a Cursor?&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Please, see the attached code.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;TIA for your help!&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;F.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 11 Apr 2012 19:33:52 GMT</pubDate>
    <dc:creator>FrançoisRobitaille</dc:creator>
    <dc:date>2012-04-11T19:33:52Z</dc:date>
    <item>
      <title>Using a FeatureCursor with ISelectionSet.Search with Option Strict On</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/using-a-featurecursor-with-iselectionset-search/m-p/123508#M3262</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi everyone,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I'm having this problem when I try to convert this simple Function from VBA to VB.Net with The "&lt;/SPAN&gt;&lt;STRONG&gt;Option Strict On&lt;/STRONG&gt;&lt;SPAN&gt;"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I Wish to use a FeatureCursor to retreive all the Features selected in a FeatureLayer.&amp;nbsp; In VBA, we were able to pass a FeatureCursor to the Search Method of ISelectionSet.&amp;nbsp; In .Net, with Option Strict On, this is not possible anymore.&amp;nbsp; We have to pass a Cursor (otherwise a CType conversion will be requiered, wich won't work anyway!)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;So my question is how do I access the Feature if I can only use a Cursor?&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Please, see the attached code.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;TIA for your help!&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;F.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 11 Apr 2012 19:33:52 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/using-a-featurecursor-with-iselectionset-search/m-p/123508#M3262</guid>
      <dc:creator>FrançoisRobitaille</dc:creator>
      <dc:date>2012-04-11T19:33:52Z</dc:date>
    </item>
    <item>
      <title>Re: Using a FeatureCursor with ISelectionSet.Search with Option Strict On</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/using-a-featurecursor-with-iselectionset-search/m-p/123509#M3263</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;All you need to do is cast your Cursor.NextRow as an IFeature:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim SelFeature As IFeature = Nothing
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim Cursor As ICursor = Nothing
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; SelSet.Search(Nothing, True, Cursor)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; SelFeature = CType(Cursor.NextRow, IFeature)
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Note the following excerpt from &lt;/SPAN&gt;&lt;A href="http://www.codeproject.com/Articles/5044/Cheat-Sheet-Casting-in-VB-NET-and-C" rel="nofollow noopener noreferrer" target="_blank"&gt;here&lt;/A&gt;&lt;SPAN&gt;:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;By default in VB, casting is automatically done for you when you assign objects to variables. The objects are then automatically casted to the variables' type.&lt;BR /&gt;&lt;BR /&gt;This behavior can be influenced by an option line on top of your code file:&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;Option Strict On
Option Strict Off&lt;/PRE&gt;&lt;BR /&gt;When on, casting is strict and not automatic.&lt;/BLOCKQUOTE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 07:05:39 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/using-a-featurecursor-with-iselectionset-search/m-p/123509#M3263</guid>
      <dc:creator>KevinBupp</dc:creator>
      <dc:date>2021-12-11T07:05:39Z</dc:date>
    </item>
    <item>
      <title>Re: Using a FeatureCursor with ISelectionSet.Search with Option Strict On</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/using-a-featurecursor-with-iselectionset-search/m-p/123510#M3264</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;That's great!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;It works just fine!&amp;nbsp; Thank you!&amp;nbsp; I'll be more carefull with my casting in the future!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanx again!&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;F.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 12 Apr 2012 13:26:56 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/using-a-featurecursor-with-iselectionset-search/m-p/123510#M3264</guid>
      <dc:creator>FrançoisRobitaille</dc:creator>
      <dc:date>2012-04-12T13:26:56Z</dc:date>
    </item>
  </channel>
</rss>

