Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How do you put a vlue in a grid text box?
Message
De
18/12/1997 15:44:19
 
 
À
18/12/1997 15:06:11
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00066977
Message ID:
00067043
Vues:
28
>>>I am trying to put a value in a grid test box. To get this
>>>value , I am adding up other texts boxes in the same grid.
>>>example..
>>>grid
>>>a b c d
>>>I want the value of d to be a+b+c only if a > 0..
>>>any ideas?
>>
>>exclusive iif?
>Hi Dave ... Merry Christmas..
>OK - that sounds good, but what GRID method do I use for the code?

I'm no expert, but I had to do some math in a grid before. Thought I could use the "grid1.column1.textbox1.value + grid1.column2.textbox1.value" syntax but this didn't work. I ended up using the field names from the table to do the math.

here is the code I used in the GOTFOCUS event of the text box in the grid, comments and all


******snip******
*GRID1.TotalTime.text1.GotFocus
*I perform all the calculations for TotalTime,
*RegTime, OverTime, & DoubleTime here. Notice
*the use of REPLACE as opposed to ThisForm syntax
*This seemed to be the only way to get the calulations
*to work correctly.
m.cCurrentAlias = ALIAS()
IF ALIAS() != 'TIMEITMS'
SELECT 'TIMEITMS'
ENDIF
REPLACE TOTALTIME WITH TIMEOUT - TIMEIN
m.nOverTime = TOTALTIME * THISFORM.OTPERCENT1.VALUE
m.nDblTime = 0
m.nOvrTime = 0
DO CASE
CASE CDOW(THISFORM.DATE1.VALUE) = 'Saturday' && Day of week is Saturday
DO CASE && Check for DoubleTime
CASE TIMEOUT <= 17
m.nOvrTime = TIMEOUT - TIMEIN
CASE TIMEOUT >= 17 AND TIMEIN <= 17
m.nDblTime = TIMEOUT - 17
m.nOvrTime = 17 - TIMEIN
CASE TIMEOUT >= 17 AND TIMEIN >= 17
m.nDblTime = TIMEOUT - TIMEIN
ENDCASE
IF m.nOvrTime > 0
REPLACE OVERTIME WITH m.nOvrTime
ENDIF
IF m.nDblTime >0
REPLACE DOUBLETIME WITH m.nDblTime
ENDIF
CASE CDOW(THISFORM.DATE1.VALUE) = 'Sunday' && Day of week is Sunday
IF EMPTY(DOUBLETIME)
REPLACE DOUBLETIME WITH TOTALTIME
ENDIF
OTHERWISE
IF EMPTY(REGTIME)
REPLACE REGTIME WITH TOTALTIME - m.nOverTime
ENDIF
IF EMPTY(OVERTIME)
REPLACE OVERTIME WITH m.nOverTime
ENDIF
THISFORM.REFRESH
IF ALIAS() != (m.cCurrentAlias)
SELECT (m.cCurrentAlias)
ENDIF
ENDCASE

THISFORM.TotalRefresh()
****SNIP*****

hope this give you some Ideas
Jon Wilshusen
Thanks
Jon
Non-MVP Non-MCP Non-MCSE

Visual FoxPro, What else is there?
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform