Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Is it possible to make a property as an array? 1

Status
Not open for further replies.

RedLion

Programmer
Sep 13, 2000
342
NL
Hello,

I've got an object with properties, and the init of it has the statement:

DIMENSION THIS.haContactPersoon(3,5)

haContactPersoon is a propertie from the object. On this statement I got the error:

'haContactPersoon' is not an array.

Is it not allowed what I wan't, or what is the problem?

If I delclare a new variabele instead of a propertie as an array, I didn't got an error.

Thanks

Charl
 
The property haContactPerson is created as:
Class, New property
Name: haContactPerson(3,5) ?

Declaring the dimension (any dimension) when creating the property will force VFP to see the property as an array.
Diederik Vermeeren
verm1864@exact.nl
 
Are you DIMENSIONing the array in the DEFINE CLASS... END DEFINE?
-Pete
 
Hi,

I built my own classes by new class as custom with classbrowser in a .vcx - file (not in a .prg file).
I add some methods and properties like haContactPerson as HIDDEN.

In the Init of the class I declare haContactPerson as an array. As written above, and the debugger reports the error as written above.

Thanks

Charl
 
When you added the property, did you add it as

'aMyArray[1]' (as the name)

or just as

'aMyArray' ??

If you have done the last, it will make it a boolean by default and you cannot use it as an array.

You should add the property as 'aMyArray[1]'. It is then an array and you can redimension it to whatever size you like. (See also Diederik's comment).

In the properties list of your class it will appear as aMyArray[1,0] (indicating that it is an array).

HTH, Weedz
veld4663@exact.nl

'It never hurts to help...' - Eek the cat.
 
Thanks Weedz,

That was the problem, I had to make it as aContactPerson(1) when using add property.

By the way, are there other things to remember like array's when using add property or add method?
By add method to make a function instead of a procedure is it also done at this kind of a way?

thanks

Charl
 
Few bugs and traps from the MSDN:

<a
href=&quot; Method Fires for Properties that Do Not Exist</a>
<a
href=&quot; Does Not Work in OLE DLL</a>
<a
href=&quot; Fails With Initial Value of Type Currency</a>
Jon Hawkins
jonscott8@yahoo.com

The World Is Headed For Mutiny,
When All We Want Is Unity. - Creed
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top