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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VFP6 define array property in class problem

Status
Not open for further replies.

gringoloco

Programmer
Sep 18, 2003
7
GB
I have a class based on a form class. I want to add an array propery to it. When I use add property in the class designer and enter the name as cColwidths[4] it comes back with an error message "Invalid Name".

(It works OK if I leave off the [4].)

If I create an actual form I can add an array property but I would like it in the class itself.

Can anybody help?
 
gringoloco

What version of VFP are you using? Works for me in VFP7.0, VFP6.0 and VFP8.0 and NOT in VFP5.0.

Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
Mike

I am using VFP 6.0 sp 5. As you say - it should work....
Is there another way to get at the class declare section rather than through the class designer?
 
What has worked for me is adding the array as a form property in either the init or load methods.

Code:
THISFORM.AddProperty('cColwidths[4]')
DIMENSION THISFORM.cColwidths[4]

Not sure if this is the best way to do it but it is working in several of my form classes.
 
Try playing a little battleship with it and see what you get:

cColwidths[4,1]
cColwidths(4)
cColwidths(4,1)
cColwidths(1)

Make sure there are no extra spaces in what you are putting in. Also, restart VFP6 and see if maybe there is something that just got messed up with the current VFP IDE process.

boyd.gif

 
Have found a free utility that allows access to all the methods/properties of the class: RAS Hack SCX/VCX

rickschummer.com/vfptools/hackform.htm

This has done the trick!

Thanks for the suggestions.
 
Instead of battleship, think warfare.

If you *Accidently*, clicked on the "Class-->New Method..." menu, then, a message just like you stated comes up, "Invalid Name".

Many times I make the same mistake of adding a Method instead of a property, in my haste.

"I thought if I make every mistake, only thing left is perfection..." - justamistere, a Mister E., a mystery
 
Mike,

I can do this is VFP 5 and did it in 3 with no problem and did for years. I am not sure why this is the case in your experience. I only get this error when I try to add a method with array syntax.


_RAS
VFP MVP
 
gringoloco,

Glad you like RAS Hack SCX/VCX and that it did the trick for you. If you like this tool you likely will really appreciate its professional cousin called HackCX Professional available on my company's Web site.


_RAS
VFP MVP
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top