FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Please Explain why this won't work
Posts: 933
Joined: Sun Oct 09, 2005 01:05 PM

Please Explain why this won't work

Posted: Sun Dec 11, 2005 01:15 AM

Hi,

In my app I have a dialog that has 10 "parts" listed on the screen.
Part1, Part2 .... Part10

I have a function that will work with these PART fields (using Tdatabase)

Function MyFunction( cNumber ) //cNumber can be from "1" to "10"
Local cTempPart
cTempPart := oPartsDBF:Part&cNumber //This works

oPartsDBF:Part&cNumber := cSomeText //This does not error but will return an empty string.

Return .t.

If I use an actual number ( oPartsDBF:Part1 := cSomeText ) it works.

Why can I use the &cNumber to store a value to cTempPart but can't do it the other way.

Thanks in advance,
Jeff

Thanks,

Jeff Barnes



(FWH 16.11, xHarbour 1.2.3, Bcc730)
Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM

Please Explain why this won't work

Posted: Sun Dec 11, 2005 11:51 AM

Jeff,

Better use the __ObjSendMsg() function:

Instead of cTempPart := oPartsDBF:Part&cNumber:

cTempPart := __ObjSendMsg( oPartsDBF, "Part" + cNumber )

and instead of oPartsDBF:Part&cNumber := cSomeText:

__ObjSendMsg( oPartsDBF, "_Part" + cNumber, cSomeText )

Notice the use of "_" before "Part" when assigning.

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 933
Joined: Sun Oct 09, 2005 01:05 PM

Please Explain why this won't work

Posted: Sun Dec 11, 2005 03:41 PM

Thanks Antonio.

Works perfectly.

Thanks,

Jeff Barnes



(FWH 16.11, xHarbour 1.2.3, Bcc730)

Continue the discussion