HOW TO put a selection in a dataset?

Dec 10, 2014 at 2:46 PM
I know how to put the data of a layer to a datatable, change some things and update the shape by using the next code.... this works BUT (see part after the code)
Dim dtGebouwen As DataTable
Dim GebouwenLayer As FeatureLayer
GebouwenLayer = TryCast(Form1.myVenster.Layers.SelectedLayer, FeatureLayer)
dtGebouwen = GebouwenLayer.DataSet.DataTable

'i put here below code to change things in the datatable
                 ----
'the following instructions are needed to update data of the datatable to the file, and to refresh the view on the screen on the basis of your simbology
 GebouwenLayer.DataSet.Features.SuspendEvents()
GebouwenLayer.DataSet.InitializeVertices()
GebouwenLayer.AssignFastDrawnStates()
GebouwenLayer.DataSet.UpdateExtent()
GebouwenLayer.DataSet.Save()
GebouwenLayer.DataSet.InvalidateVertices()
GebouwenLayer.DataSet.Features.ResumeEvents()
Form1.myVenster.Refresh()
but how to do this when i have a selection of the shape by using...
 Dim GebouwenLayer As FeatureLayer
Dim fsLayer As FeatureSet
GebouwenLayer = TryCast(Me.myVenster.Layers.SelectedLayer, FeatureLayer)
fsLayer = GebouwenLayer.Selection.ToFeatureSet()
__dtGebouwenSelectie = fsLayer.DataTable__
in the last row, i seem not be able to convert a selection to a dataset somehow so its automaticly updated when i chance data in the datatable....

anyone have the smallest suggestion?
Dec 10, 2014 at 3:03 PM
Edited Dec 10, 2014 at 3:07 PM
or perhaps from a different view if i have the datatable of the selection should i make some code to read the rows one by one and overwrite the corresponding rows in the mother-dataset-datatable by checking row for row??

or is there a smarter way to update the mother datatable with the data in the selection datatable....
Developer
Dec 10, 2014 at 4:50 PM
I think if you want to update the mother-dataset you have to update it row by row.

GebouwenLayer.Selection.ToFeatureSet() creates new objects that are no longer connected to your selected layer. That's why the data in your mother-dataset doesn't get updated when you change something in fsLayer.DataTable.
Dec 11, 2014 at 12:40 AM
I understand thanx and already programmed that solution but was hoping for a more automatic elegant way :)
Developer
Dec 11, 2014 at 8:25 AM
I know only one way where you wouldn't have to copy data. You would have take the whole GebouwenLayer.dataset.datatable and use the normal datatable-select function to filter the rows shown to the user. But that means you could only select by attribute or have to get the FIDs of the selected features and filter the datatable by these FIDs.