Hello everyone,
Any sample showing how to show all the selected features from a feature class in a map in a DataGridView.
I am building an add-in for that.
Will you use a dockable window or a regular window?
Thanks
Jose,
Is using DataGridView in .NET a definite requirement? If not, and you're using the JS API, check out Using FeatureTable | ArcGIS API for JavaScript
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.
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.
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 dgvRow = New System.Windows.Forms.DataGridViewRow dgvCell = New System.Windows.Forms.DataGridViewCheckBoxCell dgvRow.Cells.Add(dgvCell) dgvCell = New System.Windows.Forms.DataGridViewTextBoxCell dgvCell.Value = pFeature.OID dgvRow.Cells.Add(dgvCell) dgvCell = New System.Windows.Forms.DataGridViewTextBoxCell dgvCell.Value = pFeature.Value(IDIndex) dgvRow.Cells.Add(dgvCell) dgvCell = New System.Windows.Forms.DataGridViewTextBoxCell dgvCell.Value = pFeature.Value(NameIndex) dgvRow.Cells.Add(dgvCell) dgvMPAs.Rows.Add(dgvRow) pFeature = pFCursor.NextFeature Loop
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.
Aangemelde leden kunnen berichten plaatsen, updates volgen en meer. Nieuw hier? Registreer een gratis account.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.