Creating a combo-box without Extent

mikelcid

New Member
Hi all!

I'm creating a combo-box with the names of the tables from a DB. I have a problem with the array that I add to the combo-box.

Code:
i = 1.
        DEFINE VARIABLE arrayvar0 AS System.Object EXTENT NO-UNDO.
        FOR EACH _file  WHERE _file._Hidden = FALSE NO-LOCK:
            arrayvar0[i] = _file._file-name.
            i = i + 1.
        END.
        THIS-OBJECT:comboBox1:Items:AddRange(arrayvar0).
        THIS-OBJECT:comboBox1:Location = NEW System.Drawing.Point(252, 96).
        THIS-OBJECT:comboBox1:Name = "comboBox1".
        THIS-OBJECT:comboBox1:Size = NEW System.Drawing.Size(107, 24).
        THIS-OBJECT:comboBox1:TabIndex = 3.
        THIS-OBJECT:comboBox1:SelectedIndexChanged:Subscribe(THIS-OBJECT:comboBox1_SelectedIndexChanged).


When executing this code it throws the error 11389:

Invalid assignment to an unfixed indeterminate extent (11389)

The indeterminate extent being referenced has not been set to a fixed dimension. Only a fixed size array or another indeterminate array can be assigned to it. You cannot assign a scalar value to an indeterminate array. If the source is defined to be a .NET array, but its value is Unknown, this is treated as a scalar object reference. Thus you cannot assign this to an indeterminate array.

The problem is in the EXTENT of the array, I have tried to passed it an integer variable with the size it will have but it doesn't work fine and leaving it in blank throws this error.

Anybody knows where is the problem? I'm Openedge Architect 10.2B

Thx in advance!
 
I find the solution in another post, this will bt the correct way to assign an extent to an array after defining it:

Code:
i = 0.
        FOR EACH _file  WHERE _file._Hidden = FALSE NO-LOCK:
            i = i + 1.
        END.
        DEFINE VARIABLE arrayvar0 AS System.Object EXTENT NO-UNDO.
        ASSIGN EXTENT(arrayvar0) = i.
        i = 1.
        FOR EACH _file  WHERE _file._Hidden = FALSE NO-LOCK:
            arrayvar0[i] = _file._file-name.
            i = i + 1.
        END.
        THIS-OBJECT:comboBox1:Items:AddRange(arrayvar0).
        THIS-OBJECT:comboBox1:Location = NEW System.Drawing.Point(252, 96).
        THIS-OBJECT:comboBox1:Name = "comboBox1".
        THIS-OBJECT:comboBox1:Size = NEW System.Drawing.Size(107, 24).
        THIS-OBJECT:comboBox1:TabIndex = 3.
        THIS-OBJECT:comboBox1:SelectedIndexChanged:Subscribe(THIS-OBJECT:comboBox1_SelectedIndexChanged).
 
Back
Top