add values in textbox

hi,

how can i add valuse in tet boxes.

eg- i have two text boxes called x and y how can i add content of thosetwo boxs and assing the sum to a variable.

thanks.

please some one help me quickly.

Thanks.

What are the source expressions of the text boxes?

Assume X is unitprice without GSt and Y is GST value. I want to add X and Y and assign that value into another text box called Z. I know how to do this in VB- Z.text=X.text+Y.text. But I dont know how to do this in NAV. Please help me.

Thanks.

Not quite answering my question above. Nevertheless I will give it a try:

  1. Declare three variables of typ Decimal: X, Y and Z
  2. Set SourceExpr property of the first two text boxes as follows:
    • Text Box 1: SourceExpr = X
    • Text Box 2: SourceExpr = Y
  3. Create the following function (trigger):

CalcTotal(X : Decimal;Y : Decimal) : Decimal
EXIT(X + Y);

  1. Put in OnValidate-trigger of each of the first two text boxes this statement:

CalcTotal(X, Y);

  1. Set SourceExpr property of the third text boxes to: SourceExpr = CalcTotal(X, Y)

If X en Y are fields of a table (and your form is bounded to that table) you should define the function and the call to that function in the OnValiadte-triggers on the table.

Thank you vey much for your reply, as you mentioned what I have to do is

“X en Y are fields of a table (and your form is bounded to that table) you should define the function and the call to that function in the OnValiadte-triggers on the table.”

how can I use above answr to get data from a table and calculate total. Is following steps are correct or wroung.

  1. creat 2 text boxes and in there proprty window set sourceexp to particuler table filds.

  2. then add textbox1 and 2 content and assign the sum to textbox3.( but I dont no how to get textbox1 and 2 contents- that is the problem)

Thanks.

Basically you are right.

You ‘get’ the content of text box 1 and 2 by just using the field names that had assigned to these text boxes, i.e. that you entered in the SourceExpr property. That’s all.

Let’s say these fields are called X and Y (just like the variables in my example above). You bound the text boxes (1 and 2) to them by assigning X and Y to the SourceExpr property. So the content of the text boxes is actually the content of X and Y. Anything you want to do (calculate) with the content is through X and Y. Like in my example statements above.

Thanks Luc.