Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Best practice – Form Calculations
Message
 
 
To
01/05/2005 23:14:29
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Environment versions
Visual FoxPro:
VFP 9
OS:
Windows XP SP2
Network:
Windows XP
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01009973
Message ID:
01010074
Views:
35
Mike,

1. Add new record
2. Call Thisform.Calculateit()
3. Thisform.Refresh()


>
>Sergey’s approach is the one I am familiar with from DOS days, using memory variables.
>
>I am running into the same problem using either Sergey’s or Glenn & Tore’s method.
>
>The problem is that TxtnTotal is carrying over the total from the previous form when I hit new.
>
>How do I get txtnTotal to initialize to zero for a new record?
>
>Table Junk
> Key c 8
> Myvalue1 n 10 2
> Myvalue2 n 10 2
>
>On form Fields
> TxtMyValue1 control source Junk.Myvalue1
> TxtMyValue2 control source Junk.Myvalue2
> TxtnTotal control source <>
>
>Form::Calculateit
> WITH Thisform
> .txtnTotal.value = .txtMyValue1.value + .txtmyvalue2.value
> ENDWITH
>
>Sergey’s Approch:
>
> Form::Init
> DODEFAULT()
> Thisform.Calculateit()
>
> TxtMyValue1::Valid
> Thisform.Calulateit()
>
> TxtMyValue2::Valid
> Thisform.Calulateit()
>
>Glenn & Tore’s Approch:
>
> Form::Init
> DODEFAULT()
> Bindevent(this.txtMyValue1,”lostfocus”,this,”Calculateit”,1)
> Bindevent(this.txtMyValue2,”lostfocus”,this,”Calculateit”,1)
> Thisform.Calculateit()
--sb--
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform