AnsweredAssumed Answered

Assigning text to a MultiTextBox object using a variable that contains the name of the MultiTextBox object

Question asked by gregory.schmitz@ngc.com on Jun 3, 2019
Latest reply on Jun 5, 2019 by gregory.schmitz@ngc.com

Hello everyone, I have presented the following question to a few of the Mentor team members. They were unsure as to whether or not the following is possible, so I decided I'd ask here to see if anyone has successfully implemented something similar to what I am trying to do.

 

Thanks in advance!

-Greg

 

I am currently looking to create a loop that dynamically sets the text in MultiEditBoxes by name in a form. For example, the MultiEditBoxes are named "TonyBox", "BruceBox", "SteveBox", "ThorBox". I want to store "Tony", "Bruce", "Steve", "Thor" in an array. I then want to create a loop that iterates through the array and creates a variable that contains the concatenation of "Box" and the current array entry. I then want to use this created variable to assign a value to the Text field associated with the variable name.

Pseudocode for this operation is something like this:

               Dim MTBarray

               Dim MultTextBoxName

               Dim TextToApply

 

               TextToApply = "Test"

               MTBarray = Array("Tony", "Bruce", "Steve", "Thor")

 

               For index = 0 To 3

                              MultTextBoxName = MTBarray(index) & "Box"

                              MultTextBoxName.Text = TextToApply & index 

               Next

 

Desired Result:

               TonyBox.Text contains Test0

               BruceBox.Text contains Test1

               SteveBox.Text contains Test2

               ThorBox.Text contains Test3

I have also tried using the Execute() and Eval() sub/function without success.

The basic functionality I am most interested is how to make the script assign TextToApply & index to the MultiTextBox text property that MuiltTextBoxName.Text refers to.

Outcomes