Click here to Skip to main content
15,885,366 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
i have tried this but the answer is wrong
AFTotal.Text = Val(TotalCashEmoluments.Text) * Val(0.05)
please help me where am i going wrong
Posted
Comments
Richard Deeming 2-Nov-15 10:03am    
What is the text in the TotalCashEmoluments control?
What is the result displayed in the AFTotal control?
Masta Pee 3-Nov-15 4:03am    
the text in the TotalCashEmoluments is a number and the Result in AFTotal is 0
Richard Deeming 3-Nov-15 7:39am    
Yes, but what is the text in the TotalCashEmoluments control?

We cannot see your screen. You need to tell us what the text is.
Masta Pee 4-Nov-15 5:55am    
the text is 1000
Richard Deeming 4-Nov-15 9:04am    
I've just tried the following code:
Val("1000") * Val(0.05)

The output, as expected, is 50.

Either there are other characters in the textbox which you haven't told us about, or your computer's regional settings are set to a culture which cannot recognize the string "1000" as a valid number.

Debug your code. Assign Val(TotalCashEmoluments.Text) to a temporary variable, and see what value it gets. If it's 0, then double-check the TotalCashEmoluments.Text value.

1 solution

 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900