<?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 How to show selected features in a DataGridView (VB.net or C#) in Developers Questions</title>
    <link>https://community.esri.com/t5/developers-questions/how-to-show-selected-features-in-a-datagridview-vb/m-p/336127#M2155</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello everyone,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any sample showing how to show all the selected features from a feature class in a map in a&amp;nbsp; DataGridView.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am building an add-in for that.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Will you use a dockable window or a regular window?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 10 Jul 2015 14:56:20 GMT</pubDate>
    <dc:creator>JoseSanchez</dc:creator>
    <dc:date>2015-07-10T14:56:20Z</dc:date>
    <item>
      <title>How to show selected features in a DataGridView (VB.net or C#)</title>
      <link>https://community.esri.com/t5/developers-questions/how-to-show-selected-features-in-a-datagridview-vb/m-p/336127#M2155</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello everyone,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any sample showing how to show all the selected features from a feature class in a map in a&amp;nbsp; DataGridView.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am building an add-in for that.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Will you use a dockable window or a regular window?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Jul 2015 14:56:20 GMT</pubDate>
      <guid>https://community.esri.com/t5/developers-questions/how-to-show-selected-features-in-a-datagridview-vb/m-p/336127#M2155</guid>
      <dc:creator>JoseSanchez</dc:creator>
      <dc:date>2015-07-10T14:56:20Z</dc:date>
    </item>
    <item>
      <title>Re: How to show selected features in a DataGridView (VB.net or C#)</title>
      <link>https://community.esri.com/t5/developers-questions/how-to-show-selected-features-in-a-datagridview-vb/m-p/336128#M2156</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Jose,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is using DataGridView in .NET a definite requirement? If not, and you're using the JS API, check out &lt;A href="https://developers.arcgis.com/javascript/jssamples/featuretable.html" title="https://developers.arcgis.com/javascript/jssamples/featuretable.html"&gt;Using FeatureTable | ArcGIS API for JavaScript&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am using the JS API on a site with a vb.net back-end... Not sure if you are in a similar scenario - by add-in, are you referring to extending ArcGIS Desktop? If so, you can disregard my suggestion! Looks like Ken has a solution for that.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Jul 2015 15:03:33 GMT</pubDate>
      <guid>https://community.esri.com/t5/developers-questions/how-to-show-selected-features-in-a-datagridview-vb/m-p/336128#M2156</guid>
      <dc:creator>ChrisSmith7</dc:creator>
      <dc:date>2015-07-10T15:03:33Z</dc:date>
    </item>
    <item>
      <title>Re: How to show selected features in a DataGridView (VB.net or C#)</title>
      <link>https://community.esri.com/t5/developers-questions/how-to-show-selected-features-in-a-datagridview-vb/m-p/336129#M2157</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;In one app, I used a DataGridView (dgvMPAs) to hold features. I didn't show all the attributes of the features in the table, just a selection of them. I also added a check box into each row.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;pFCursor = pMPAFClass.Search(Nothing, False)
pFeature = pFCursor.NextFeature

Dim dgvRow As System.Windows.Forms.DataGridViewRow
Dim dgvCell As System.Windows.Forms.DataGridViewCell
Dim NameIndex As Integer = pMPAFClass.FindField("SITE_NAME")
Dim IDIndex As Integer = pMPAFClass.FindField("SITE_ID")

Do While Not pFeature Is Nothing
&amp;nbsp;&amp;nbsp;&amp;nbsp; dgvRow = New System.Windows.Forms.DataGridViewRow
&amp;nbsp;&amp;nbsp;&amp;nbsp; dgvCell = New System.Windows.Forms.DataGridViewCheckBoxCell
&amp;nbsp;&amp;nbsp;&amp;nbsp; dgvRow.Cells.Add(dgvCell)

&amp;nbsp;&amp;nbsp;&amp;nbsp; dgvCell = New System.Windows.Forms.DataGridViewTextBoxCell
&amp;nbsp;&amp;nbsp;&amp;nbsp; dgvCell.Value = pFeature.OID
&amp;nbsp;&amp;nbsp;&amp;nbsp; dgvRow.Cells.Add(dgvCell)

&amp;nbsp;&amp;nbsp;&amp;nbsp; dgvCell = New System.Windows.Forms.DataGridViewTextBoxCell
&amp;nbsp;&amp;nbsp;&amp;nbsp; dgvCell.Value = pFeature.Value(IDIndex)
&amp;nbsp;&amp;nbsp;&amp;nbsp; dgvRow.Cells.Add(dgvCell)

&amp;nbsp;&amp;nbsp;&amp;nbsp; dgvCell = New System.Windows.Forms.DataGridViewTextBoxCell
&amp;nbsp;&amp;nbsp;&amp;nbsp; dgvCell.Value = pFeature.Value(NameIndex)
&amp;nbsp;&amp;nbsp;&amp;nbsp; dgvRow.Cells.Add(dgvCell)

&amp;nbsp;&amp;nbsp;&amp;nbsp; dgvMPAs.Rows.Add(dgvRow)

&amp;nbsp;&amp;nbsp;&amp;nbsp; pFeature = pFCursor.NextFeature
Loop&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In the form, I set up the DataGridView with four columns, with the OID field's visibility set to false. The user didn't need to see it, but I used it when doing a search on the selected records (selected by the check box) later.&lt;/P&gt;&lt;P&gt;&lt;IMG alt="DataGridView.png" class="image-1 jive-image" src="https://community.esri.com/legacyfs/online/116400_DataGridView.png" style="width: 620px; height: 544px;" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 15:55:55 GMT</pubDate>
      <guid>https://community.esri.com/t5/developers-questions/how-to-show-selected-features-in-a-datagridview-vb/m-p/336129#M2157</guid>
      <dc:creator>KenBuja</dc:creator>
      <dc:date>2021-12-11T15:55:55Z</dc:date>
    </item>
  </channel>
</rss>

