Skip to main content

[Migrated content. Thread originally posted on 22 July 2004]

I want to write the following VB Statements in AcuCOBOL. What is the correct syntax?

sbrStatus.Panels.Item(2).Text ="My New Value"

or

sbrStatus.Panels(2).Text ="My New Value"


where sbrStatus = object, panels = collection, Item = property of the collection and text is the property of the item.

Thanks.

[Migrated content. Thread originally posted on 22 July 2004]

I want to write the following VB Statements in AcuCOBOL. What is the correct syntax?

sbrStatus.Panels.Item(2).Text ="My New Value"

or

sbrStatus.Panels(2).Text ="My New Value"


where sbrStatus = object, panels = collection, Item = property of the collection and text is the property of the item.

Thanks.
Originally posted by SRFish
I want to write the following VB Statements in AcuCOBOL. What is the correct syntax?

sbrStatus.Panels.Item(2).Text ="My New Value"


You would think the quick code to make this work would be:
MODIFY @sbrStatus::Panels::Item(2)::Text = "My New Value"
but this does not work because acucobol will not automatically generate a temporary handle for an object in the collection and then dispose of it. So you must do it manually.

I use the approach of getting a handle for the item in the collection and then use that handle to modify it's properties and then dispose of the handle. Remember to declare a variable, with the data type of the collection item, to hold the handle.

Example:


      * Working storage for item data type in the collection
           77 sbrPanel HANDLE OF Panel.
      * Get handle for item in collection.
           INQUIRE sbrStatus @Panels::Item(2)
               IN sbrPanel.
           MODIFY sbrPanel @Text = "My New Value".
      *Dispose of handle to avoid memory leaks
           DESTROY sbrPanel.

[Migrated content. Thread originally posted on 22 July 2004]

I want to write the following VB Statements in AcuCOBOL. What is the correct syntax?

sbrStatus.Panels.Item(2).Text ="My New Value"

or

sbrStatus.Panels(2).Text ="My New Value"


where sbrStatus = object, panels = collection, Item = property of the collection and text is the property of the item.

Thanks.
Thanks Dan works well.... Sorry have been away for a while and have just got back to this.

Thanks again.