[Gambas-user] format number messing up equation

Pablo Vera pvera at ...729...
Sun Mar 6 23:58:37 CET 2005


When using the % sign in the format function, it will automatically 
multiply the value by 100, so you would use it like this:

Message.Info("You answered " & countCorrect & " questions correct.\n\n"
& "You answered " & countWrong & " questions wrong." & "\n\n\n" & "Your
score for this test is " & Format$(countCorrect/counter,"##.# %") &
"\n\n" )

Saludos,
Pablo Vera

Neil Fallon wrote:
> Hi,
> 
> When using the Format$ to format the output of a number I am getting the
> wrong result.  If I don't use it I get the correct result.
> 
> Code works
> 
> Message.Info("You answered " & countCorrect & " questions correct.\n\n"
> & "You answered " & countWrong & " questions wrong." & "\n\n\n" & "Your
> score for this test is " & countCorrect/counter*100 & "%\n\n" )
> 
> 
> Doesn't work
> 
> Message.Info("You answered " & countCorrect & " questions correct.\n\n"
> & "You answered " & countWrong & " questions wrong." & "\n\n\n" & "Your
> score for this test is " & Format$(countCorrect/counter*100,"##.# %") &
> "\n\n" )
> 
> With the section that doesn't work I am getting results like 5000%
> instead of 50%
> 
> Neil
> 
>  
> 
> 
> 
> -------------------------------------------------------
> SF email is sponsored by - The IT Product Guide
> Read honest & candid reviews on hundreds of IT Products from real users.
> Discover which products truly live up to the hype. Start reading now.
> http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
> _______________________________________________
> Gambas-user mailing list
> Gambas-user at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user
> 
> 
> 




More information about the User mailing list