Skip to main content
added 28 characters in body
Source Link
Hornbydd
  • 44.6k
  • 5
  • 42
  • 84

Disclaimer: I am basically brand new to VB.NET and ArcObjects.

I am computing some statistics as a component of a larger arcobject script. I write these components to an ITable. This ITable is added to the map display as a standalone table.

I find that I am duplicating a fair bit of code to assign a value to each field in the table. This is not something I would do in Python and wonder if a better methods applies in the VB.Net world.

VB.NET CODE:

   'Populate the stats table with the iteration.
    Dim row As IRow = tTable.CreateRow
    Dim fields As IFields = row.Fields

    Dim fThres As Double = fields.FindField("ThreshDist")
    row.Value(fThres) = lStats(0)
    row.Store()

    Dim fCountR As Double = fields.FindField("CountR")
    row.Value(fCountR) = lStats(1)
    row.Store()
   'Populate the stats table with the iteration.
    Dim row As IRow = tTable.CreateRow
    Dim fields As IFields = row.Fields

    Dim fThres As Double = fields.FindField("ThreshDist")
    row.Value(fThres) = lStats(0)
    row.Store()

    Dim fCountR As Double = fields.FindField("CountR")
    row.Value(fCountR) = lStats(1)
    row.Store()

where lStats is a list of doubles, and tTable is an ITable object.

In python I would simply use a dictionary to map the index (as key) to the fields name, as value. A simple for loop would take care of population using an insert cursor.

Does a similar paradigm exist using VB.Net? Am I missing something obvious in the documentation?

Disclaimer: I am basically brand new to VB.NET and ArcObjects.

I am computing some statistics as a component of a larger arcobject script. I write these components to an ITable. This ITable is added to the map display as a standalone table.

I find that I am duplicating a fair bit of code to assign a value to each field in the table. This is not something I would do in Python and wonder if a better methods applies in the VB.Net world.

VB.NET CODE:

   'Populate the stats table with the iteration.
    Dim row As IRow = tTable.CreateRow
    Dim fields As IFields = row.Fields

    Dim fThres As Double = fields.FindField("ThreshDist")
    row.Value(fThres) = lStats(0)
    row.Store()

    Dim fCountR As Double = fields.FindField("CountR")
    row.Value(fCountR) = lStats(1)
    row.Store()

where lStats is a list of doubles, and tTable is an ITable object.

In python I would simply use a dictionary to map the index (as key) to the fields name, as value. A simple for loop would take care of population using an insert cursor.

Does a similar paradigm exist using VB.Net? Am I missing something obvious in the documentation?

Disclaimer: I am basically brand new to VB.NET and ArcObjects.

I am computing some statistics as a component of a larger arcobject script. I write these components to an ITable. This ITable is added to the map display as a standalone table.

I find that I am duplicating a fair bit of code to assign a value to each field in the table. This is not something I would do in Python and wonder if a better methods applies in the VB.Net world.

VB.NET CODE:

   'Populate the stats table with the iteration.
    Dim row As IRow = tTable.CreateRow
    Dim fields As IFields = row.Fields

    Dim fThres As Double = fields.FindField("ThreshDist")
    row.Value(fThres) = lStats(0)
    row.Store()

    Dim fCountR As Double = fields.FindField("CountR")
    row.Value(fCountR) = lStats(1)
    row.Store()

where lStats is a list of doubles, and tTable is an ITable object.

In python I would simply use a dictionary to map the index (as key) to the fields name, as value. A simple for loop would take care of population using an insert cursor.

Does a similar paradigm exist using VB.Net? Am I missing something obvious in the documentation?

Source Link
Jay Laura
  • 4.5k
  • 1
  • 23
  • 43

VB.Net Field Population Methods

Disclaimer: I am basically brand new to VB.NET and ArcObjects.

I am computing some statistics as a component of a larger arcobject script. I write these components to an ITable. This ITable is added to the map display as a standalone table.

I find that I am duplicating a fair bit of code to assign a value to each field in the table. This is not something I would do in Python and wonder if a better methods applies in the VB.Net world.

VB.NET CODE:

   'Populate the stats table with the iteration.
    Dim row As IRow = tTable.CreateRow
    Dim fields As IFields = row.Fields

    Dim fThres As Double = fields.FindField("ThreshDist")
    row.Value(fThres) = lStats(0)
    row.Store()

    Dim fCountR As Double = fields.FindField("CountR")
    row.Value(fCountR) = lStats(1)
    row.Store()

where lStats is a list of doubles, and tTable is an ITable object.

In python I would simply use a dictionary to map the index (as key) to the fields name, as value. A simple for loop would take care of population using an insert cursor.

Does a similar paradigm exist using VB.Net? Am I missing something obvious in the documentation?